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
@@ -44,12 +47,12 @@ test( "element types", function( assert ) {
44
47
45
48
test ( "No options, relative" , function ( ) {
46
49
expect ( 2 ) ;
47
- TestHelpers . draggable . shouldMove ( $ ( "#draggable1" ) . draggable ( ) , "no options, relative" ) ;
50
+ draggableTestHelpers . shouldMove ( $ ( "#draggable1" ) . draggable ( ) , "no options, relative" ) ;
48
51
} ) ;
49
52
50
53
test ( "No options, absolute" , function ( ) {
51
54
expect ( 2 ) ;
52
- TestHelpers . draggable . shouldMove ( $ ( "#draggable2" ) . draggable ( ) , "no options, absolute" ) ;
55
+ draggableTestHelpers . shouldMove ( $ ( "#draggable2" ) . draggable ( ) , "no options, absolute" ) ;
53
56
} ) ;
54
57
55
58
test ( "resizable handle with complex markup (#8756 / #8757)" , function ( ) {
@@ -92,7 +95,7 @@ test( "#8269: Removing draggable element on drop", function() {
92
95
} ) ;
93
96
94
97
// Support: Opera 12.10, Safari 5.1, jQuery <1.8
95
- if ( TestHelpers . draggable . unreliableContains ) {
98
+ if ( draggableTestHelpers . unreliableContains ) {
96
99
ok ( true , "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" ) ;
97
100
ok ( true , "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" ) ;
98
101
} else {
@@ -118,7 +121,7 @@ test( "Stray mousemove after mousedown still drags", function() {
118
121
$ ( document ) . simulate ( "mousemove" , { button : - 1 } ) ;
119
122
} ) ;
120
123
121
- TestHelpers . draggable . shouldMove ( element , "element is draggable" ) ;
124
+ draggableTestHelpers . shouldMove ( element , "element is draggable" ) ;
122
125
} ) ;
123
126
124
127
test ( "#6258: not following mouse when scrolled and using overflow-y: scroll" , function ( ) {
@@ -138,7 +141,7 @@ test( "#6258: not following mouse when scrolled and using overflow-y: scroll", f
138
141
oldOverflowY = $ ( "html" ) . css ( "overflow-y" ) ,
139
142
oldOverflowX = $ ( "html" ) . css ( "overflow-x" ) ;
140
143
141
- TestHelpers . forceScrollableWindow ( ) ;
144
+ testHelpers . forceScrollableWindow ( ) ;
142
145
143
146
$ ( "html" )
144
147
. css ( "overflow-y" , "scroll" )
@@ -164,7 +167,7 @@ test( "#9315: jumps down with offset of scrollbar", function() {
164
167
}
165
168
} ) ;
166
169
167
- TestHelpers . forceScrollableWindow ( ) ;
170
+ testHelpers . forceScrollableWindow ( ) ;
168
171
169
172
$ ( "html" ) . scrollTop ( 300 ) . scrollLeft ( 300 ) ;
170
173
@@ -198,7 +201,7 @@ test( "scroll offset with fixed ancestors", function() {
198
201
}
199
202
} ) ;
200
203
201
- TestHelpers . forceScrollableWindow ( ) ;
204
+ testHelpers . forceScrollableWindow ( ) ;
202
205
203
206
$ ( "#wrapper" ) . css ( "position" , "fixed" ) ;
204
207
$ ( "#wrapper2" ) . css ( "position" , "absolute" ) ;
@@ -269,8 +272,8 @@ test( "#5727: draggable from iframe", function() {
269
272
equal ( draggable1 . closest ( iframeBody ) . length , 1 ) ;
270
273
271
274
// TODO: fix draggable within an IFRAME to fire events on the element properly
272
- // and these TestHelpers.draggable .shouldMove relies on events for testing
273
- //TestHelpers.draggable .shouldMove( draggable1, "draggable from an iframe" );
275
+ // and these draggableTestHelpers .shouldMove relies on events for testing
276
+ //draggableTestHelpers .shouldMove( draggable1, "draggable from an iframe" );
274
277
} ) ;
275
278
276
279
test ( "#8399: A draggable should become the active element after you are finished interacting with it, but not before." , function ( ) {
@@ -282,7 +285,7 @@ test( "#8399: A draggable should become the active element after you are finishe
282
285
notStrictEqual ( document . activeElement , element . get ( 0 ) , "moving a draggable anchor did not make it the active element" ) ;
283
286
} ) ;
284
287
285
- TestHelpers . draggable . move ( element , 50 , 50 ) ;
288
+ draggableTestHelpers . move ( element , 50 , 50 ) ;
286
289
287
290
strictEqual ( document . activeElement , element . get ( 0 ) , "finishing moving a draggable anchor made it the active element" ) ;
288
291
} ) ;
@@ -293,16 +296,16 @@ asyncTest( "blur behavior", function() {
293
296
var element = $ ( "#draggable1" ) . draggable ( ) ,
294
297
focusElement = $ ( "<div tabindex='1'></div>" ) . appendTo ( element ) ;
295
298
296
- TestHelpers . onFocus ( focusElement , function ( ) {
299
+ testHelpers . onFocus ( focusElement , function ( ) {
297
300
strictEqual ( document . activeElement , focusElement . get ( 0 ) , "test element is focused before mousing down on a draggable" ) ;
298
301
299
- TestHelpers . draggable . move ( focusElement , 1 , 1 ) ;
302
+ draggableTestHelpers . move ( focusElement , 1 , 1 ) ;
300
303
301
304
// http://bugs.jqueryui.com/ticket/10527
302
305
// Draggable: Can't select option in modal dialog (IE8)
303
306
strictEqual ( document . activeElement , focusElement . get ( 0 ) , "test element is focused after mousing down on itself" ) ;
304
307
305
- TestHelpers . draggable . move ( element , 50 , 50 ) ;
308
+ draggableTestHelpers . move ( element , 50 , 50 ) ;
306
309
307
310
// http://bugs.jqueryui.com/ticket/4261
308
311
// active element should blur when mousing down on a draggable
@@ -341,4 +344,4 @@ test( "ui-draggable-handle managed correctly in nested draggables", function( as
341
344
assert . hasClasses ( child , "ui-draggable-handle" , "child retains class name on destroy" ) ;
342
345
} ) ;
343
346
344
- } ) ( jQuery ) ;
347
+ } ) ;
0 commit comments