11TestHelpers . draggable = {
2- // todo : remove the unreliable offset hacks
2+ // TODO : remove the unreliable offset hacks
33 unreliableOffset : $ . ui . ie && ( ! document . documentMode || document . documentMode < 8 ) ? 2 : 0 ,
44 // Support: Opera 12.10, Safari 5.1, jQuery <1.8
55 unreliableContains : function ( ) {
66 var element = $ ( "<div>" ) ;
77 return $ . contains ( element [ 0 ] . ownerDocument , element [ 0 ] ) ;
88 } ( ) ,
9- testDrag : function ( el , handle , dx , dy , expectedDX , expectedDY , msg ) {
9+ testDrag : function ( el , handle , dx , dy , expectedDX , expectedDY , msg ) {
1010 var offsetAfter , actual , expected ,
1111 offsetBefore = el . offset ( ) ;
1212
@@ -20,64 +20,60 @@ TestHelpers.draggable = {
2020 expected = { left : offsetBefore . left + expectedDX , top : offsetBefore . top + expectedDY } ;
2121
2222 msg = msg ? msg + "." : "" ;
23- deepEqual ( actual , expected , "dragged[" + dx + ", " + dy + "] " + msg ) ;
23+ deepEqual ( actual , expected , "dragged[" + dx + ", " + dy + "] " + msg ) ;
2424 } ,
25- shouldMove : function ( el , why ) {
26- TestHelpers . draggable . testDrag ( el , el , 50 , 50 , 50 , 50 , why ) ;
25+ shouldMove : function ( el , why ) {
26+ TestHelpers . draggable . testDrag ( el , el , 50 , 50 , 50 , 50 , why ) ;
2727 } ,
28- shouldNotMove : function ( el , why ) {
29- TestHelpers . draggable . testDrag ( el , el , 50 , 50 , 0 , 0 , why ) ;
28+ shouldNotMove : function ( el , why ) {
29+ TestHelpers . draggable . testDrag ( el , el , 50 , 50 , 0 , 0 , why ) ;
3030 } ,
31- testScroll : function ( el , position ) {
32- var oldPosition = $ ( "#main" ) . css ( "position" ) ;
33- $ ( "#main" ) . css ( "position" , position ) ;
34- TestHelpers . draggable . shouldMove ( el , position + " parent" ) ;
35- $ ( "#main" ) . css ( "position" , oldPosition ) ;
31+ testScroll : function ( el , position ) {
32+ var oldPosition = $ ( "#main" ) . css ( "position" ) ;
33+ $ ( "#main" ) . css ( "position" , position ) ;
34+ TestHelpers . draggable . shouldMove ( el , position + " parent" ) ;
35+ $ ( "#main" ) . css ( "position" , oldPosition ) ;
3636 } ,
3737 restoreScroll : function ( what ) {
3838 if ( what ) {
39- $ ( document ) . scrollTop ( 0 ) ; $ ( document ) . scrollLeft ( 0 ) ;
39+ $ ( document ) . scrollTop ( 0 ) . scrollLeft ( 0 ) ;
4040 } else {
41- $ ( "#main" ) . scrollTop ( 0 ) ; $ ( "#main" ) . scrollLeft ( 0 ) ;
41+ $ ( "#main" ) . scrollTop ( 0 ) . scrollLeft ( 0 ) ;
4242 }
4343 } ,
4444 setScroll : function ( what ) {
45- if ( what ) {
46- // todo : currently, the draggable interaction doesn't properly account for scrolled pages,
45+ if ( what ) {
46+ // TODO : currently, the draggable interaction doesn't properly account for scrolled pages,
4747 // uncomment the line below to make the tests fail that should when the page is scrolled
48- // $(document).scrollTop(100); $(document ).scrollLeft(100);
48+ // $( document ).scrollTop( 100 ).scrollLeft( 100 );
4949 } else {
50- $ ( "#main" ) . scrollTop ( 100 ) ; $ ( "#main" ) . scrollLeft ( 100 ) ;
50+ $ ( "#main" ) . scrollTop ( 100 ) . scrollLeft ( 100 ) ;
5151 }
5252 } ,
53- border : function ( el , side ) {
54- return parseInt ( el . css ( "border-" + side + "-width" ) , 10 ) || 0 ;
53+ border : function ( el , side ) {
54+ return parseInt ( el . css ( "border-" + side + "-width" ) , 10 ) || 0 ;
5555 } ,
56- margin : function ( el , side ) {
57- return parseInt ( el . css ( "margin-" + side ) , 10 ) || 0 ;
56+ margin : function ( el , side ) {
57+ return parseInt ( el . css ( "margin-" + side ) , 10 ) || 0 ;
5858 } ,
5959 move : function ( el , x , y ) {
60-
6160 $ ( el ) . simulate ( "drag" , {
6261 dx : x ,
6362 dy : y
6463 } ) ;
65-
6664 } ,
6765 trackMouseCss : function ( el ) {
6866 el . bind ( "drag" , function ( ) {
69- el . data ( "last_dragged_cursor" , $ ( "body" ) . css ( "cursor" ) ) ;
67+ el . data ( "last_dragged_cursor" , $ ( "body" ) . css ( "cursor" ) ) ;
7068 } ) ;
7169 } ,
7270 trackAppendedParent : function ( el ) {
73-
74- // appendTo ignored without being clone
71+ // TODO: appendTo is currently ignored if helper is original (see #7044)
7572 el . draggable ( "option" , "helper" , "clone" ) ;
7673
74+ // Get what parent is at time of drag
7775 el . bind ( "drag" , function ( e , ui ) {
78- // Get what parent is at time of drag
79- el . data ( "last_dragged_parent" , ui . helper . parent ( ) [ 0 ] ) ;
76+ el . data ( "last_dragged_parent" , ui . helper . parent ( ) [ 0 ] ) ;
8077 } ) ;
81-
8278 }
8379} ;
0 commit comments