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 ) {
6
9
7
10
module ( "draggable: core" ) ;
8
11
@@ -51,12 +54,12 @@ test( "element types", function( assert ) {
51
54
52
55
test ( "No options, relative" , function ( ) {
53
56
expect ( 2 ) ;
54
- TestHelpers . draggable . shouldMove ( $ ( "#draggable1" ) . draggable ( ) , "no options, relative" ) ;
57
+ draggableTestHelpers . shouldMove ( $ ( "#draggable1" ) . draggable ( ) , "no options, relative" ) ;
55
58
} ) ;
56
59
57
60
test ( "No options, absolute" , function ( ) {
58
61
expect ( 2 ) ;
59
- TestHelpers . draggable . shouldMove ( $ ( "#draggable2" ) . draggable ( ) , "no options, absolute" ) ;
62
+ draggableTestHelpers . shouldMove ( $ ( "#draggable2" ) . draggable ( ) , "no options, absolute" ) ;
60
63
} ) ;
61
64
62
65
test ( "resizable handle with complex markup (#8756 / #8757)" , function ( ) {
@@ -99,7 +102,7 @@ test( "#8269: Removing draggable element on drop", function() {
99
102
} ) ;
100
103
101
104
// Support: Opera 12.10, Safari 5.1, jQuery <1.8
102
- if ( TestHelpers . draggable . unreliableContains ) {
105
+ if ( draggableTestHelpers . unreliableContains ) {
103
106
ok ( true , "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" ) ;
104
107
ok ( true , "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" ) ;
105
108
} else {
@@ -125,7 +128,7 @@ test( "Stray mousemove after mousedown still drags", function() {
125
128
$ ( document ) . simulate ( "mousemove" , { button : - 1 } ) ;
126
129
} ) ;
127
130
128
- TestHelpers . draggable . shouldMove ( element , "element is draggable" ) ;
131
+ draggableTestHelpers . shouldMove ( element , "element is draggable" ) ;
129
132
} ) ;
130
133
131
134
test ( "#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
145
148
oldOverflowY = $ ( "html" ) . css ( "overflow-y" ) ,
146
149
oldOverflowX = $ ( "html" ) . css ( "overflow-x" ) ;
147
150
148
- TestHelpers . forceScrollableWindow ( ) ;
151
+ testHelpers . forceScrollableWindow ( ) ;
149
152
150
153
$ ( "html" )
151
154
. css ( "overflow-y" , "scroll" )
@@ -171,7 +174,7 @@ test( "#9315: jumps down with offset of scrollbar", function() {
171
174
}
172
175
} ) ;
173
176
174
- TestHelpers . forceScrollableWindow ( ) ;
177
+ testHelpers . forceScrollableWindow ( ) ;
175
178
176
179
$ ( "html" ) . scrollTop ( 300 ) . scrollLeft ( 300 ) ;
177
180
@@ -205,7 +208,7 @@ test( "scroll offset with fixed ancestors", function() {
205
208
}
206
209
} ) ;
207
210
208
- TestHelpers . forceScrollableWindow ( ) ;
211
+ testHelpers . forceScrollableWindow ( ) ;
209
212
210
213
$ ( "#wrapper" ) . css ( "position" , "fixed" ) ;
211
214
$ ( "#wrapper2" ) . css ( "position" , "absolute" ) ;
@@ -276,8 +279,8 @@ test( "#5727: draggable from iframe", function() {
276
279
equal ( draggable1 . closest ( iframeBody ) . length , 1 ) ;
277
280
278
281
// 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" );
281
284
} ) ;
282
285
283
286
test ( "#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
289
292
notStrictEqual ( document . activeElement , element . get ( 0 ) , "moving a draggable anchor did not make it the active element" ) ;
290
293
} ) ;
291
294
292
- TestHelpers . draggable . move ( element , 50 , 50 ) ;
295
+ draggableTestHelpers . move ( element , 50 , 50 ) ;
293
296
294
297
strictEqual ( document . activeElement , element . get ( 0 ) , "finishing moving a draggable anchor made it the active element" ) ;
295
298
} ) ;
@@ -300,16 +303,16 @@ asyncTest( "blur behavior", function() {
300
303
var element = $ ( "#draggable1" ) . draggable ( ) ,
301
304
focusElement = $ ( "<div tabindex='1'></div>" ) . appendTo ( element ) ;
302
305
303
- TestHelpers . onFocus ( focusElement , function ( ) {
306
+ testHelpers . onFocus ( focusElement , function ( ) {
304
307
strictEqual ( document . activeElement , focusElement . get ( 0 ) , "test element is focused before mousing down on a draggable" ) ;
305
308
306
- TestHelpers . draggable . move ( focusElement , 1 , 1 ) ;
309
+ draggableTestHelpers . move ( focusElement , 1 , 1 ) ;
307
310
308
311
// http://bugs.jqueryui.com/ticket/10527
309
312
// Draggable: Can't select option in modal dialog (IE8)
310
313
strictEqual ( document . activeElement , focusElement . get ( 0 ) , "test element is focused after mousing down on itself" ) ;
311
314
312
- TestHelpers . draggable . move ( element , 50 , 50 ) ;
315
+ draggableTestHelpers . move ( element , 50 , 50 ) ;
313
316
314
317
// http://bugs.jqueryui.com/ticket/4261
315
318
// 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 ) {
361
364
362
365
element . draggable ( ) ;
363
366
364
- TestHelpers . draggable . move ( element , - 50 , - 50 ) ;
367
+ draggableTestHelpers . move ( element , - 50 , - 50 ) ;
365
368
366
369
finalOffset = element . offset ( ) ;
367
370
finalOffset . left += 50 ;
@@ -373,4 +376,4 @@ test( "setting right/bottom css shouldn't cause resize", function( assert ) {
373
376
assert . close ( finalOffset . top , origOffset . top , "element moves the correct horizontal distance" ) ;
374
377
} ) ;
375
378
376
- } ) ( jQuery ) ;
379
+ } ) ;
0 commit comments