diff --git a/tests/.jshintrc b/tests/.jshintrc index 7c79a5c04..c196d86ef 100644 --- a/tests/.jshintrc +++ b/tests/.jshintrc @@ -23,6 +23,7 @@ "Globalize", "module", "notEqual", + "notDeepEqual", "notStrictEqual", "ok", "QUnit", diff --git a/tests/jquery.simulate.js b/tests/jquery.simulate.js index 0ae88c20f..6e2f3ba8e 100644 --- a/tests/jquery.simulate.js +++ b/tests/jquery.simulate.js @@ -277,18 +277,30 @@ function findCenter( elem ) { }; } +function findCorner( elem ) { + var offset, + document = $( elem.ownerDocument ); + elem = $( elem ); + offset = elem.offset(); + + return { + x: offset.left - document.scrollLeft(), + y: offset.top - document.scrollTop() + }; +} + $.extend( $.simulate.prototype, { simulateDrag: function() { var i = 0, target = this.target, options = this.options, - center = findCenter( target ), + center = options.handle === "corner" ? findCorner( target ) : findCenter( target ), x = Math.floor( center.x ), y = Math.floor( center.y ), - dx = options.dx || 0, - dy = options.dy || 0, - moves = options.moves || 3, - coord = { clientX: x, clientY: y }; + coord = { clientX: x, clientY: y }, + dx = options.dx || ( options.x !== undefined ? options.x - x : 0 ), + dy = options.dy || ( options.y !== undefined ? options.y - y : 0 ), + moves = options.moves || 3; this.simulateEvent( target, "mousedown", coord ); diff --git a/tests/unit/draggable/draggable.html b/tests/unit/draggable/draggable.html index 50bed8caf..6380f3e85 100644 --- a/tests/unit/draggable/draggable.html +++ b/tests/unit/draggable/draggable.html @@ -6,12 +6,12 @@ - + - + @@ -23,7 +23,8 @@ "ui/jquery.ui.widget.js", "ui/jquery.ui.mouse.js", "ui/jquery.ui.resizable.js", - "ui/jquery.ui.draggable.js" + "ui/jquery.ui.draggable.js", + "ui/jquery.ui.droppable.js" ] }); @@ -45,15 +46,12 @@