1
1
define ( [
2
+ "qunit" ,
2
3
"jquery" ,
3
4
"ui/widget"
4
- ] , function ( $ ) {
5
+ ] , function ( QUnit , $ ) {
5
6
6
- module ( "widget animation" , ( function ( ) {
7
+ QUnit . module ( "widget animation" , ( function ( ) {
7
8
var show = $ . fn . show ,
8
9
fadeIn = $ . fn . fadeIn ,
9
10
slideDown = $ . fn . slideDown ;
@@ -29,43 +30,43 @@ module( "widget animation", (function() {
29
30
} ;
30
31
} ( ) ) ) ;
31
32
32
- asyncTest ( "show: null" , function ( ) {
33
- expect ( 4 ) ;
33
+ QUnit . asyncTest ( "show: null" , function ( assert ) {
34
+ assert . expect ( 4 ) ;
34
35
35
36
var element = $ ( "#widget" ) . testWidget ( ) ,
36
37
hasRun = false ;
37
38
$ . fn . show = function ( ) {
38
- ok ( true , "show called" ) ;
39
- equal ( arguments . length , 0 , "no args passed to show" ) ;
39
+ assert . ok ( true , "show called" ) ;
40
+ assert . equal ( arguments . length , 0 , "no args passed to show" ) ;
40
41
} ;
41
42
42
43
element
43
44
. delay ( 50 )
44
45
. queue ( function ( next ) {
45
- ok ( ! hasRun , "queue before show" ) ;
46
+ assert . ok ( ! hasRun , "queue before show" ) ;
46
47
next ( ) ;
47
48
} )
48
49
. testWidget ( "show" , function ( ) {
49
50
hasRun = true ;
50
51
} )
51
52
. queue ( function ( next ) {
52
- ok ( hasRun , "queue after show" ) ;
53
- start ( ) ;
53
+ assert . ok ( hasRun , "queue after show" ) ;
54
+ QUnit . start ( ) ;
54
55
next ( ) ;
55
56
} ) ;
56
57
} ) ;
57
58
58
- asyncTest ( "show: true" , function ( ) {
59
- expect ( 4 ) ;
59
+ QUnit . asyncTest ( "show: true" , function ( assert ) {
60
+ assert . expect ( 4 ) ;
60
61
61
62
var element = $ ( "#widget" ) . testWidget ( {
62
63
show : true
63
64
} ) ,
64
65
hasRun = false ;
65
66
$ . fn . fadeIn = function ( duration , easing , complete ) {
66
67
return this . queue ( function ( next ) {
67
- strictEqual ( duration , undefined , "duration" ) ;
68
- strictEqual ( easing , undefined , "easing" ) ;
68
+ assert . strictEqual ( duration , undefined , "duration" ) ;
69
+ assert . strictEqual ( easing , undefined , "easing" ) ;
69
70
complete ( ) ;
70
71
next ( ) ;
71
72
} ) ;
@@ -74,30 +75,30 @@ asyncTest( "show: true", function() {
74
75
element
75
76
. delay ( 50 )
76
77
. queue ( function ( next ) {
77
- ok ( ! hasRun , "queue before show" ) ;
78
+ assert . ok ( ! hasRun , "queue before show" ) ;
78
79
next ( ) ;
79
80
} )
80
81
. testWidget ( "show" , function ( ) {
81
82
hasRun = true ;
82
83
} )
83
84
. queue ( function ( next ) {
84
- ok ( hasRun , "queue after show" ) ;
85
- start ( ) ;
85
+ assert . ok ( hasRun , "queue after show" ) ;
86
+ QUnit . start ( ) ;
86
87
next ( ) ;
87
88
} ) ;
88
89
} ) ;
89
90
90
- asyncTest ( "show: number" , function ( ) {
91
- expect ( 4 ) ;
91
+ QUnit . asyncTest ( "show: number" , function ( assert ) {
92
+ assert . expect ( 4 ) ;
92
93
93
94
var element = $ ( "#widget" ) . testWidget ( {
94
95
show : 123
95
96
} ) ,
96
97
hasRun = false ;
97
98
$ . fn . fadeIn = function ( duration , easing , complete ) {
98
99
return this . queue ( function ( next ) {
99
- strictEqual ( duration , 123 , "duration" ) ;
100
- strictEqual ( easing , undefined , "easing" ) ;
100
+ assert . strictEqual ( duration , 123 , "duration" ) ;
101
+ assert . strictEqual ( easing , undefined , "easing" ) ;
101
102
complete ( ) ;
102
103
next ( ) ;
103
104
} ) ;
@@ -106,30 +107,30 @@ asyncTest( "show: number", function() {
106
107
element
107
108
. delay ( 50 )
108
109
. queue ( function ( next ) {
109
- ok ( ! hasRun , "queue before show" ) ;
110
+ assert . ok ( ! hasRun , "queue before show" ) ;
110
111
next ( ) ;
111
112
} )
112
113
. testWidget ( "show" , function ( ) {
113
114
hasRun = true ;
114
115
} )
115
116
. queue ( function ( next ) {
116
- ok ( hasRun , "queue after show" ) ;
117
- start ( ) ;
117
+ assert . ok ( hasRun , "queue after show" ) ;
118
+ QUnit . start ( ) ;
118
119
next ( ) ;
119
120
} ) ;
120
121
} ) ;
121
122
122
- asyncTest ( "show: core animation" , function ( ) {
123
- expect ( 4 ) ;
123
+ QUnit . asyncTest ( "show: core animation" , function ( assert ) {
124
+ assert . expect ( 4 ) ;
124
125
125
126
var element = $ ( "#widget" ) . testWidget ( {
126
127
show : "slideDown"
127
128
} ) ,
128
129
hasRun = false ;
129
130
$ . fn . slideDown = function ( duration , easing , complete ) {
130
131
return this . queue ( function ( next ) {
131
- strictEqual ( duration , undefined , "duration" ) ;
132
- strictEqual ( easing , undefined , "easing" ) ;
132
+ assert . strictEqual ( duration , undefined , "duration" ) ;
133
+ assert . strictEqual ( easing , undefined , "easing" ) ;
133
134
complete ( ) ;
134
135
next ( ) ;
135
136
} ) ;
@@ -138,31 +139,31 @@ asyncTest( "show: core animation", function() {
138
139
element
139
140
. delay ( 50 )
140
141
. queue ( function ( next ) {
141
- ok ( ! hasRun , "queue before show" ) ;
142
+ assert . ok ( ! hasRun , "queue before show" ) ;
142
143
next ( ) ;
143
144
} )
144
145
. testWidget ( "show" , function ( ) {
145
146
hasRun = true ;
146
147
} )
147
148
. queue ( function ( next ) {
148
- ok ( hasRun , "queue after show" ) ;
149
- start ( ) ;
149
+ assert . ok ( hasRun , "queue after show" ) ;
150
+ QUnit . start ( ) ;
150
151
next ( ) ;
151
152
} ) ;
152
153
} ) ;
153
154
154
- asyncTest ( "show: effect" , function ( ) {
155
- expect ( 5 ) ;
155
+ QUnit . asyncTest ( "show: effect" , function ( assert ) {
156
+ assert . expect ( 5 ) ;
156
157
157
158
var element = $ ( "#widget" ) . testWidget ( {
158
159
show : "testEffect"
159
160
} ) ,
160
161
hasRun = false ;
161
162
$ . fn . show = function ( options ) {
162
163
return this . queue ( function ( next ) {
163
- equal ( options . effect , "testEffect" , "effect" ) ;
164
- ok ( ! ( "duration" in options ) , "duration" ) ;
165
- ok ( ! ( "easing" in options ) , "easing" ) ;
164
+ assert . equal ( options . effect , "testEffect" , "effect" ) ;
165
+ assert . ok ( ! ( "duration" in options ) , "duration" ) ;
166
+ assert . ok ( ! ( "easing" in options ) , "easing" ) ;
166
167
options . complete ( ) ;
167
168
next ( ) ;
168
169
} ) ;
@@ -171,21 +172,21 @@ asyncTest( "show: effect", function() {
171
172
element
172
173
. delay ( 50 )
173
174
. queue ( function ( next ) {
174
- ok ( ! hasRun , "queue before show" ) ;
175
+ assert . ok ( ! hasRun , "queue before show" ) ;
175
176
next ( ) ;
176
177
} )
177
178
. testWidget ( "show" , function ( ) {
178
179
hasRun = true ;
179
180
} )
180
181
. queue ( function ( next ) {
181
- ok ( hasRun , "queue after show" ) ;
182
- start ( ) ;
182
+ assert . ok ( hasRun , "queue after show" ) ;
183
+ QUnit . start ( ) ;
183
184
next ( ) ;
184
185
} ) ;
185
186
} ) ;
186
187
187
- asyncTest ( "show: object(core animation)" , function ( ) {
188
- expect ( 4 ) ;
188
+ QUnit . asyncTest ( "show: object(core animation)" , function ( assert ) {
189
+ assert . expect ( 4 ) ;
189
190
190
191
var element = $ ( "#widget" ) . testWidget ( {
191
192
show : {
@@ -197,8 +198,8 @@ asyncTest( "show: object(core animation)", function() {
197
198
hasRun = false ;
198
199
$ . fn . slideDown = function ( duration , easing , complete ) {
199
200
return this . queue ( function ( next ) {
200
- equal ( duration , 123 , "duration" ) ;
201
- equal ( easing , "testEasing" , "easing" ) ;
201
+ assert . equal ( duration , 123 , "duration" ) ;
202
+ assert . equal ( easing , "testEasing" , "easing" ) ;
202
203
complete ( ) ;
203
204
next ( ) ;
204
205
} ) ;
@@ -207,21 +208,21 @@ asyncTest( "show: object(core animation)", function() {
207
208
element
208
209
. delay ( 50 )
209
210
. queue ( function ( next ) {
210
- ok ( ! hasRun , "queue before show" ) ;
211
+ assert . ok ( ! hasRun , "queue before show" ) ;
211
212
next ( ) ;
212
213
} )
213
214
. testWidget ( "show" , function ( ) {
214
215
hasRun = true ;
215
216
} )
216
217
. queue ( function ( next ) {
217
- ok ( hasRun , "queue after show" ) ;
218
- start ( ) ;
218
+ assert . ok ( hasRun , "queue after show" ) ;
219
+ QUnit . start ( ) ;
219
220
next ( ) ;
220
221
} ) ;
221
222
} ) ;
222
223
223
- asyncTest ( "show: object(effect)" , function ( ) {
224
- expect ( 3 ) ;
224
+ QUnit . asyncTest ( "show: object(effect)" , function ( assert ) {
225
+ assert . expect ( 3 ) ;
225
226
226
227
var element = $ ( "#widget" ) . testWidget ( {
227
228
show : {
@@ -233,7 +234,7 @@ asyncTest( "show: object(effect)", function() {
233
234
hasRun = false ;
234
235
$ . fn . show = function ( options ) {
235
236
return this . queue ( function ( next ) {
236
- deepEqual ( options , {
237
+ assert . deepEqual ( options , {
237
238
effect : "testEffect" ,
238
239
duration : 123 ,
239
240
easing : "testEasing" ,
@@ -247,15 +248,15 @@ asyncTest( "show: object(effect)", function() {
247
248
element
248
249
. delay ( 50 )
249
250
. queue ( function ( next ) {
250
- ok ( ! hasRun , "queue before show" ) ;
251
+ assert . ok ( ! hasRun , "queue before show" ) ;
251
252
next ( ) ;
252
253
} )
253
254
. testWidget ( "show" , function ( ) {
254
255
hasRun = true ;
255
256
} )
256
257
. queue ( function ( next ) {
257
- ok ( hasRun , "queue after show" ) ;
258
- start ( ) ;
258
+ assert . ok ( hasRun , "queue after show" ) ;
259
+ QUnit . start ( ) ;
259
260
next ( ) ;
260
261
} ) ;
261
262
} ) ;
0 commit comments