diff options
author | Alexander Schmitz <arschmitz@gmail.com> | 2015-08-24 08:59:44 -0400 |
---|---|---|
committer | Alexander Schmitz <arschmitz@gmail.com> | 2015-09-11 08:29:09 -0400 |
commit | 8336ba7b694fbf85ec893ce79343a9f510a1e0b0 (patch) | |
tree | 19894ab900093e0291fecf27e1cfcadb8491e6b9 /tests/unit/draggable/helper.js | |
parent | 0cab9f0a2f1f91ae671d57dba5e5bdcde1f60622 (diff) | |
download | jquery-ui-8336ba7b694fbf85ec893ce79343a9f510a1e0b0.tar.gz jquery-ui-8336ba7b694fbf85ec893ce79343a9f510a1e0b0.zip |
Draggable: Style updates
Ref #14246
Diffstat (limited to 'tests/unit/draggable/helper.js')
-rw-r--r-- | tests/unit/draggable/helper.js | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/tests/unit/draggable/helper.js b/tests/unit/draggable/helper.js index 7aabe2a00..02a6ddaf5 100644 --- a/tests/unit/draggable/helper.js +++ b/tests/unit/draggable/helper.js @@ -8,12 +8,13 @@ return $.extend( helper, { // TODO: remove the unreliable offset hacks unreliableOffset: $.ui.ie && ( !document.documentMode || document.documentMode < 8 ) ? 2 : 0, + // Support: Opera 12.10, Safari 5.1, jQuery <1.8 - unreliableContains: (function() { + unreliableContains: ( function() { var element = $( "<div>" ); return $.contains( element[ 0 ].ownerDocument, element[ 0 ] ); - })(), + } )(), testDragPosition: function( el, dx, dy, expectedDX, expectedDY, msg ) { msg = msg ? msg + "." : ""; @@ -21,7 +22,7 @@ return $.extend( helper, { $( el ).one( "dragstop", function( event, ui ) { var positionExpected = { left: ui.originalPosition.left + expectedDX, top: ui.originalPosition.top + expectedDY }; deepEqual( ui.position, positionExpected, "position dragged[" + dx + ", " + dy + "] " + msg ); - }); + } ); }, testDragOffset: function( el, dx, dy, expectedDX, expectedDY, msg ) { @@ -32,7 +33,7 @@ return $.extend( helper, { $( el ).one( "dragstop", function( event, ui ) { deepEqual( ui.offset, offsetExpected, "offset dragged[" + dx + ", " + dy + "] " + msg ); - }); + } ); }, testDragHelperOffset: function( el, dx, dy, expectedDX, expectedDY, msg ) { @@ -43,7 +44,7 @@ return $.extend( helper, { $( el ).one( "dragstop", function( event, ui ) { deepEqual( ui.helper.offset(), offsetExpected, "offset dragged[" + dx + ", " + dy + "] " + msg ); - }); + } ); }, testDrag: function( el, handle, dx, dy, expectedDX, expectedDY, msg ) { @@ -53,7 +54,7 @@ return $.extend( helper, { $( handle ).simulate( "drag", { dx: dx, dy: dy - }); + } ); }, shouldMovePositionButNotOffset: function( el, msg, handle ) { @@ -64,7 +65,7 @@ return $.extend( helper, { $( handle ).simulate( "drag", { dx: 100, dy: 100 - }); + } ); }, shouldMove: function( el, msg, handle ) { @@ -86,12 +87,12 @@ return $.extend( helper, { element.on( "dragstop", function() { ok( false, "should not drag " + msg ); - }); + } ); $( handle ).simulate( "drag", { dx: 100, dy: 100 - }); + } ); newOffset = element.offset(); @@ -105,12 +106,12 @@ return $.extend( helper, { setScrollable: function( what, isScrollable ) { var overflow = isScrollable ? "scroll" : "hidden"; - $( what ).css({ overflow: overflow, overflowX: overflow, overflowY: overflow }); + $( what ).css( { overflow: overflow, overflowX: overflow, overflowY: overflow } ); }, testScroll: function( el, position ) { var oldPosition = $( "#main" ).css( "position" ); - $( "#main" ).css({ position: position, top: "0px", left: "0px" }); + $( "#main" ).css( { position: position, top: "0px", left: "0px" } ); this.shouldMove( el, position + " parent" ); $( "#main" ).css( "position", oldPosition ); }, @@ -135,23 +136,24 @@ return $.extend( helper, { $( el ).simulate( "drag", { dx: x, dy: y - }); + } ); }, trackMouseCss: function( el ) { el.on( "drag", function() { el.data( "last_dragged_cursor", $( "body" ).css( "cursor" ) ); - }); + } ); }, trackAppendedParent: function( el ) { + // TODO: appendTo is currently ignored if helper is original (see #7044) el.draggable( "option", "helper", "clone" ); // Get what parent is at time of drag - el.on( "drag", function(e, ui) { + el.on( "drag", function( e, ui ) { el.data( "last_dragged_parent", ui.helper.parent()[ 0 ] ); - }); + } ); } } ); |