aboutsummaryrefslogtreecommitdiffstats
path: root/tests/jquery.simulate.js
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2013-03-07 23:56:48 +0100
committerFelix Nagel <info@felixnagel.com>2013-03-07 23:56:48 +0100
commit0bf91a41c6ea0025cdb25b55ada0dde7b8fdc0ff (patch)
treeafdfd77c7bdc18baae90aed731c6c59c2af4e184 /tests/jquery.simulate.js
parent6acc6bdd7f2fcf56d02699683de6fbec62316294 (diff)
parent5b2da7c127aa1afd9852063b6e4701ec6607e941 (diff)
downloadjquery-ui-0bf91a41c6ea0025cdb25b55ada0dde7b8fdc0ff.tar.gz
jquery-ui-0bf91a41c6ea0025cdb25b55ada0dde7b8fdc0ff.zip
Merge branch 'master' into selectmenu
Diffstat (limited to 'tests/jquery.simulate.js')
-rw-r--r--tests/jquery.simulate.js22
1 files changed, 17 insertions, 5 deletions
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 );