11define ( [
2+ "qunit" ,
23 "jquery" ,
34 "ui/widget"
4- ] , function ( $ ) {
5+ ] , function ( QUnit , $ ) {
56
6- module ( "widget animation" , ( function ( ) {
7+ QUnit . module ( "widget animation" , ( function ( ) {
78 var show = $ . fn . show ,
89 fadeIn = $ . fn . fadeIn ,
910 slideDown = $ . fn . slideDown ;
1011 return {
11- setup : function ( ) {
12+ beforeEach : function ( ) {
1213 $ . widget ( "ui.testWidget" , {
1314 _create : function ( ) {
1415 this . element . hide ( ) ;
@@ -19,7 +20,7 @@ module( "widget animation", ( function() {
1920 } ) ;
2021 $ . effects = { effect : { testEffect : $ . noop } } ;
2122 } ,
22- teardown : function ( ) {
23+ afterEach : function ( ) {
2324 delete $ . ui . testWidget ;
2425 delete $ . effects . effect . testEffect ;
2526 $ . fn . show = show ;
@@ -29,43 +30,45 @@ module( "widget animation", ( function() {
2930 } ;
3031} ( ) ) ) ;
3132
32- asyncTest ( "show: null" , function ( ) {
33- expect ( 4 ) ;
33+ QUnit . test ( "show: null" , function ( assert ) {
34+ var ready = assert . async ( ) ;
35+ assert . expect ( 4 ) ;
3436
3537 var element = $ ( "#widget" ) . testWidget ( ) ,
3638 hasRun = false ;
3739 $ . fn . show = function ( ) {
38- ok ( true , "show called" ) ;
39- equal ( arguments . length , 0 , "no args passed to show" ) ;
40+ assert . ok ( true , "show called" ) ;
41+ assert . equal ( arguments . length , 0 , "no args passed to show" ) ;
4042 } ;
4143
4244 element
4345 . delay ( 50 )
4446 . queue ( function ( next ) {
45- ok ( ! hasRun , "queue before show" ) ;
47+ assert . ok ( ! hasRun , "queue before show" ) ;
4648 next ( ) ;
4749 } )
4850 . testWidget ( "show" , function ( ) {
4951 hasRun = true ;
5052 } )
5153 . queue ( function ( next ) {
52- ok ( hasRun , "queue after show" ) ;
53- start ( ) ;
54+ assert . ok ( hasRun , "queue after show" ) ;
55+ ready ( ) ;
5456 next ( ) ;
5557 } ) ;
5658} ) ;
5759
58- asyncTest ( "show: true" , function ( ) {
59- expect ( 4 ) ;
60+ QUnit . test ( "show: true" , function ( assert ) {
61+ var ready = assert . async ( ) ;
62+ assert . expect ( 4 ) ;
6063
6164 var element = $ ( "#widget" ) . testWidget ( {
6265 show : true
6366 } ) ,
6467 hasRun = false ;
6568 $ . fn . fadeIn = function ( duration , easing , complete ) {
6669 return this . queue ( function ( next ) {
67- strictEqual ( duration , undefined , "duration" ) ;
68- strictEqual ( easing , undefined , "easing" ) ;
70+ assert . strictEqual ( duration , undefined , "duration" ) ;
71+ assert . strictEqual ( easing , undefined , "easing" ) ;
6972 complete ( ) ;
7073 next ( ) ;
7174 } ) ;
@@ -74,30 +77,31 @@ asyncTest( "show: true", function() {
7477 element
7578 . delay ( 50 )
7679 . queue ( function ( next ) {
77- ok ( ! hasRun , "queue before show" ) ;
80+ assert . ok ( ! hasRun , "queue before show" ) ;
7881 next ( ) ;
7982 } )
8083 . testWidget ( "show" , function ( ) {
8184 hasRun = true ;
8285 } )
8386 . queue ( function ( next ) {
84- ok ( hasRun , "queue after show" ) ;
85- start ( ) ;
87+ assert . ok ( hasRun , "queue after show" ) ;
88+ ready ( ) ;
8689 next ( ) ;
8790 } ) ;
8891} ) ;
8992
90- asyncTest ( "show: number" , function ( ) {
91- expect ( 4 ) ;
93+ QUnit . test ( "show: number" , function ( assert ) {
94+ var ready = assert . async ( ) ;
95+ assert . expect ( 4 ) ;
9296
9397 var element = $ ( "#widget" ) . testWidget ( {
9498 show : 123
9599 } ) ,
96100 hasRun = false ;
97101 $ . fn . fadeIn = function ( duration , easing , complete ) {
98102 return this . queue ( function ( next ) {
99- strictEqual ( duration , 123 , "duration" ) ;
100- strictEqual ( easing , undefined , "easing" ) ;
103+ assert . strictEqual ( duration , 123 , "duration" ) ;
104+ assert . strictEqual ( easing , undefined , "easing" ) ;
101105 complete ( ) ;
102106 next ( ) ;
103107 } ) ;
@@ -106,30 +110,31 @@ asyncTest( "show: number", function() {
106110 element
107111 . delay ( 50 )
108112 . queue ( function ( next ) {
109- ok ( ! hasRun , "queue before show" ) ;
113+ assert . ok ( ! hasRun , "queue before show" ) ;
110114 next ( ) ;
111115 } )
112116 . testWidget ( "show" , function ( ) {
113117 hasRun = true ;
114118 } )
115119 . queue ( function ( next ) {
116- ok ( hasRun , "queue after show" ) ;
117- start ( ) ;
120+ assert . ok ( hasRun , "queue after show" ) ;
121+ ready ( ) ;
118122 next ( ) ;
119123 } ) ;
120124} ) ;
121125
122- asyncTest ( "show: core animation" , function ( ) {
123- expect ( 4 ) ;
126+ QUnit . test ( "show: core animation" , function ( assert ) {
127+ var ready = assert . async ( ) ;
128+ assert . expect ( 4 ) ;
124129
125130 var element = $ ( "#widget" ) . testWidget ( {
126131 show : "slideDown"
127132 } ) ,
128133 hasRun = false ;
129134 $ . fn . slideDown = function ( duration , easing , complete ) {
130135 return this . queue ( function ( next ) {
131- strictEqual ( duration , undefined , "duration" ) ;
132- strictEqual ( easing , undefined , "easing" ) ;
136+ assert . strictEqual ( duration , undefined , "duration" ) ;
137+ assert . strictEqual ( easing , undefined , "easing" ) ;
133138 complete ( ) ;
134139 next ( ) ;
135140 } ) ;
@@ -138,31 +143,32 @@ asyncTest( "show: core animation", function() {
138143 element
139144 . delay ( 50 )
140145 . queue ( function ( next ) {
141- ok ( ! hasRun , "queue before show" ) ;
146+ assert . ok ( ! hasRun , "queue before show" ) ;
142147 next ( ) ;
143148 } )
144149 . testWidget ( "show" , function ( ) {
145150 hasRun = true ;
146151 } )
147152 . queue ( function ( next ) {
148- ok ( hasRun , "queue after show" ) ;
149- start ( ) ;
153+ assert . ok ( hasRun , "queue after show" ) ;
154+ ready ( ) ;
150155 next ( ) ;
151156 } ) ;
152157} ) ;
153158
154- asyncTest ( "show: effect" , function ( ) {
155- expect ( 5 ) ;
159+ QUnit . test ( "show: effect" , function ( assert ) {
160+ var ready = assert . async ( ) ;
161+ assert . expect ( 5 ) ;
156162
157163 var element = $ ( "#widget" ) . testWidget ( {
158164 show : "testEffect"
159165 } ) ,
160166 hasRun = false ;
161167 $ . fn . show = function ( options ) {
162168 return this . queue ( function ( next ) {
163- equal ( options . effect , "testEffect" , "effect" ) ;
164- ok ( ! ( "duration" in options ) , "duration" ) ;
165- ok ( ! ( "easing" in options ) , "easing" ) ;
169+ assert . equal ( options . effect , "testEffect" , "effect" ) ;
170+ assert . ok ( ! ( "duration" in options ) , "duration" ) ;
171+ assert . ok ( ! ( "easing" in options ) , "easing" ) ;
166172 options . complete ( ) ;
167173 next ( ) ;
168174 } ) ;
@@ -171,21 +177,22 @@ asyncTest( "show: effect", function() {
171177 element
172178 . delay ( 50 )
173179 . queue ( function ( next ) {
174- ok ( ! hasRun , "queue before show" ) ;
180+ assert . ok ( ! hasRun , "queue before show" ) ;
175181 next ( ) ;
176182 } )
177183 . testWidget ( "show" , function ( ) {
178184 hasRun = true ;
179185 } )
180186 . queue ( function ( next ) {
181- ok ( hasRun , "queue after show" ) ;
182- start ( ) ;
187+ assert . ok ( hasRun , "queue after show" ) ;
188+ ready ( ) ;
183189 next ( ) ;
184190 } ) ;
185191} ) ;
186192
187- asyncTest ( "show: object(core animation)" , function ( ) {
188- expect ( 4 ) ;
193+ QUnit . test ( "show: object(core animation)" , function ( assert ) {
194+ var ready = assert . async ( ) ;
195+ assert . expect ( 4 ) ;
189196
190197 var element = $ ( "#widget" ) . testWidget ( {
191198 show : {
@@ -197,8 +204,8 @@ asyncTest( "show: object(core animation)", function() {
197204 hasRun = false ;
198205 $ . fn . slideDown = function ( duration , easing , complete ) {
199206 return this . queue ( function ( next ) {
200- equal ( duration , 123 , "duration" ) ;
201- equal ( easing , "testEasing" , "easing" ) ;
207+ assert . equal ( duration , 123 , "duration" ) ;
208+ assert . equal ( easing , "testEasing" , "easing" ) ;
202209 complete ( ) ;
203210 next ( ) ;
204211 } ) ;
@@ -207,21 +214,22 @@ asyncTest( "show: object(core animation)", function() {
207214 element
208215 . delay ( 50 )
209216 . queue ( function ( next ) {
210- ok ( ! hasRun , "queue before show" ) ;
217+ assert . ok ( ! hasRun , "queue before show" ) ;
211218 next ( ) ;
212219 } )
213220 . testWidget ( "show" , function ( ) {
214221 hasRun = true ;
215222 } )
216223 . queue ( function ( next ) {
217- ok ( hasRun , "queue after show" ) ;
218- start ( ) ;
224+ assert . ok ( hasRun , "queue after show" ) ;
225+ ready ( ) ;
219226 next ( ) ;
220227 } ) ;
221228} ) ;
222229
223- asyncTest ( "show: object(effect)" , function ( ) {
224- expect ( 3 ) ;
230+ QUnit . test ( "show: object(effect)" , function ( assert ) {
231+ var ready = assert . async ( ) ;
232+ assert . expect ( 3 ) ;
225233
226234 var element = $ ( "#widget" ) . testWidget ( {
227235 show : {
@@ -233,7 +241,7 @@ asyncTest( "show: object(effect)", function() {
233241 hasRun = false ;
234242 $ . fn . show = function ( options ) {
235243 return this . queue ( function ( next ) {
236- deepEqual ( options , {
244+ assert . deepEqual ( options , {
237245 effect : "testEffect" ,
238246 duration : 123 ,
239247 easing : "testEasing" ,
@@ -247,15 +255,15 @@ asyncTest( "show: object(effect)", function() {
247255 element
248256 . delay ( 50 )
249257 . queue ( function ( next ) {
250- ok ( ! hasRun , "queue before show" ) ;
258+ assert . ok ( ! hasRun , "queue before show" ) ;
251259 next ( ) ;
252260 } )
253261 . testWidget ( "show" , function ( ) {
254262 hasRun = true ;
255263 } )
256264 . queue ( function ( next ) {
257- ok ( hasRun , "queue after show" ) ;
258- start ( ) ;
265+ assert . ok ( hasRun , "queue after show" ) ;
266+ ready ( ) ;
259267 next ( ) ;
260268 } ) ;
261269} ) ;
0 commit comments