1- /*
2- * draggable_core.js
3- */
4-
5- ( function ( $ ) {
1+ define ( [
2+ "jquery" ,
3+ "lib/helper" ,
4+ "./draggable_test_helpers" ,
5+ "ui/draggable" ,
6+ "ui/droppable" ,
7+ "ui/resizable"
8+ ] , function ( $ , testHelpers , draggableTestHelpers ) {
69
710module ( "draggable: core" ) ;
811
@@ -51,12 +54,12 @@ test( "element types", function( assert ) {
5154
5255test ( "No options, relative" , function ( ) {
5356 expect ( 2 ) ;
54- TestHelpers . draggable . shouldMove ( $ ( "#draggable1" ) . draggable ( ) , "no options, relative" ) ;
57+ draggableTestHelpers . shouldMove ( $ ( "#draggable1" ) . draggable ( ) , "no options, relative" ) ;
5558} ) ;
5659
5760test ( "No options, absolute" , function ( ) {
5861 expect ( 2 ) ;
59- TestHelpers . draggable . shouldMove ( $ ( "#draggable2" ) . draggable ( ) , "no options, absolute" ) ;
62+ draggableTestHelpers . shouldMove ( $ ( "#draggable2" ) . draggable ( ) , "no options, absolute" ) ;
6063} ) ;
6164
6265test ( "resizable handle with complex markup (#8756 / #8757)" , function ( ) {
@@ -99,7 +102,7 @@ test( "#8269: Removing draggable element on drop", function() {
99102 } ) ;
100103
101104 // Support: Opera 12.10, Safari 5.1, jQuery <1.8
102- if ( TestHelpers . draggable . unreliableContains ) {
105+ if ( draggableTestHelpers . unreliableContains ) {
103106 ok ( true , "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" ) ;
104107 ok ( true , "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" ) ;
105108 } else {
@@ -125,7 +128,7 @@ test( "Stray mousemove after mousedown still drags", function() {
125128 $ ( document ) . simulate ( "mousemove" , { button : - 1 } ) ;
126129 } ) ;
127130
128- TestHelpers . draggable . shouldMove ( element , "element is draggable" ) ;
131+ draggableTestHelpers . shouldMove ( element , "element is draggable" ) ;
129132} ) ;
130133
131134test ( "#6258: not following mouse when scrolled and using overflow-y: scroll" , function ( ) {
@@ -145,7 +148,7 @@ test( "#6258: not following mouse when scrolled and using overflow-y: scroll", f
145148 oldOverflowY = $ ( "html" ) . css ( "overflow-y" ) ,
146149 oldOverflowX = $ ( "html" ) . css ( "overflow-x" ) ;
147150
148- TestHelpers . forceScrollableWindow ( ) ;
151+ testHelpers . forceScrollableWindow ( ) ;
149152
150153 $ ( "html" )
151154 . css ( "overflow-y" , "scroll" )
@@ -171,7 +174,7 @@ test( "#9315: jumps down with offset of scrollbar", function() {
171174 }
172175 } ) ;
173176
174- TestHelpers . forceScrollableWindow ( ) ;
177+ testHelpers . forceScrollableWindow ( ) ;
175178
176179 $ ( "html" ) . scrollTop ( 300 ) . scrollLeft ( 300 ) ;
177180
@@ -205,7 +208,7 @@ test( "scroll offset with fixed ancestors", function() {
205208 }
206209 } ) ;
207210
208- TestHelpers . forceScrollableWindow ( ) ;
211+ testHelpers . forceScrollableWindow ( ) ;
209212
210213 $ ( "#wrapper" ) . css ( "position" , "fixed" ) ;
211214 $ ( "#wrapper2" ) . css ( "position" , "absolute" ) ;
@@ -276,8 +279,8 @@ test( "#5727: draggable from iframe", function() {
276279 equal ( draggable1 . closest ( iframeBody ) . length , 1 ) ;
277280
278281 // TODO: fix draggable within an IFRAME to fire events on the element properly
279- // and these TestHelpers.draggable .shouldMove relies on events for testing
280- //TestHelpers.draggable .shouldMove( draggable1, "draggable from an iframe" );
282+ // and these draggableTestHelpers .shouldMove relies on events for testing
283+ //draggableTestHelpers .shouldMove( draggable1, "draggable from an iframe" );
281284} ) ;
282285
283286test ( "#8399: A draggable should become the active element after you are finished interacting with it, but not before." , function ( ) {
@@ -289,7 +292,7 @@ test( "#8399: A draggable should become the active element after you are finishe
289292 notStrictEqual ( document . activeElement , element . get ( 0 ) , "moving a draggable anchor did not make it the active element" ) ;
290293 } ) ;
291294
292- TestHelpers . draggable . move ( element , 50 , 50 ) ;
295+ draggableTestHelpers . move ( element , 50 , 50 ) ;
293296
294297 strictEqual ( document . activeElement , element . get ( 0 ) , "finishing moving a draggable anchor made it the active element" ) ;
295298} ) ;
@@ -300,16 +303,16 @@ asyncTest( "blur behavior", function() {
300303 var element = $ ( "#draggable1" ) . draggable ( ) ,
301304 focusElement = $ ( "<div tabindex='1'></div>" ) . appendTo ( element ) ;
302305
303- TestHelpers . onFocus ( focusElement , function ( ) {
306+ testHelpers . onFocus ( focusElement , function ( ) {
304307 strictEqual ( document . activeElement , focusElement . get ( 0 ) , "test element is focused before mousing down on a draggable" ) ;
305308
306- TestHelpers . draggable . move ( focusElement , 1 , 1 ) ;
309+ draggableTestHelpers . move ( focusElement , 1 , 1 ) ;
307310
308311 // http://bugs.jqueryui.com/ticket/10527
309312 // Draggable: Can't select option in modal dialog (IE8)
310313 strictEqual ( document . activeElement , focusElement . get ( 0 ) , "test element is focused after mousing down on itself" ) ;
311314
312- TestHelpers . draggable . move ( element , 50 , 50 ) ;
315+ draggableTestHelpers . move ( element , 50 , 50 ) ;
313316
314317 // http://bugs.jqueryui.com/ticket/4261
315318 // active element should blur when mousing down on a draggable
@@ -361,7 +364,7 @@ test( "setting right/bottom css shouldn't cause resize", function( assert ) {
361364
362365 element . draggable ( ) ;
363366
364- TestHelpers . draggable . move ( element , - 50 , - 50 ) ;
367+ draggableTestHelpers . move ( element , - 50 , - 50 ) ;
365368
366369 finalOffset = element . offset ( ) ;
367370 finalOffset . left += 50 ;
@@ -373,4 +376,4 @@ test( "setting right/bottom css shouldn't cause resize", function( assert ) {
373376 assert . close ( finalOffset . top , origOffset . top , "element moves the correct horizontal distance" ) ;
374377} ) ;
375378
376- } ) ( jQuery ) ;
379+ } ) ;
0 commit comments