@@ -26,15 +26,15 @@ describe('rc-queue-anim', function () {
26
26
function shouldAnimatingThisOne ( instance , index ) {
27
27
let children = TestUtils . scryRenderedDOMComponentsWithTag ( instance , 'div' ) ;
28
28
children . forEach ( function ( node , i ) {
29
- console . log ( i , node . style . visibility , getOpacity ( node ) ) ;
29
+ console . log ( i , getOpacity ( node ) ) ;
30
30
if ( i === 0 ) {
31
31
return ;
32
32
}
33
33
if ( i <= index ) {
34
- expect ( node . style . visibility ) . to . be ( 'visible' ) ;
35
34
expect ( getOpacity ( node ) ) . to . above ( 0 ) ;
36
35
} else {
37
- expect ( node . style . visibility ) . to . be ( 'hidden' ) ;
36
+ // placeholder
37
+ expect ( node . innerHTML ) . to . be ( '' ) ;
38
38
}
39
39
} ) ;
40
40
}
@@ -191,34 +191,39 @@ describe('rc-queue-anim', function () {
191
191
left : [ 100 , 0 ]
192
192
}
193
193
} ) ;
194
- let children = TestUtils . scryRenderedDOMComponentsWithTag ( instance , 'div' ) ;
195
- expect ( isNaN ( getLeft ( children [ 1 ] ) ) ) . to . be . ok ( ) ;
196
194
setTimeout ( function ( ) {
197
- expect ( getLeft ( children [ 1 ] ) ) . to . above ( 0 ) ;
198
- done ( ) ;
199
- } , 10 ) ;
195
+ let children = TestUtils . scryRenderedDOMComponentsWithTag ( instance , 'div' ) ;
196
+ expect ( isNaN ( getLeft ( children [ 1 ] ) ) ) . to . be . ok ( ) ;
197
+ setTimeout ( function ( ) {
198
+ children = TestUtils . scryRenderedDOMComponentsWithTag ( instance , 'div' ) ;
199
+ expect ( getLeft ( children [ 1 ] ) ) . to . above ( 0 ) ;
200
+ done ( ) ;
201
+ } , 10 ) ;
202
+ } , 0 ) ;
200
203
} ) ;
201
204
202
205
it ( 'should support animation when change direction at animating' , function ( done ) {
203
206
instance = createQueueAnimInstance ( {
204
207
leaveReverse : true
205
208
} ) ;
206
- let children = TestUtils . scryRenderedDOMComponentsWithTag ( instance , 'div' ) ;
207
209
let index = 0 ;
208
210
let maxOpacity ;
209
211
let opacityArray = [ ] ;
210
212
let interval = setInterval ( function ( ) {
211
213
index += 1 ;
212
- let opacity = getOpacity ( children [ 1 ] ) ;
213
- opacityArray . push ( opacity ) ;
214
+ let opacity = getOpacity ( TestUtils . scryRenderedDOMComponentsWithTag ( instance , 'div' ) [ 1 ] ) ;
215
+ if ( ! isNaN ( opacity ) ) {
216
+ opacityArray . push ( opacity ) ;
217
+ }
214
218
console . log ( 'time: ' , index * 30 , 'opacity: ' , opacity ) ;
215
219
if ( index === 10 ) {
216
220
instance . toggle ( ) ;
217
221
maxOpacity = opacity ;
218
222
console . log ( 'toggle' ) ;
219
223
}
220
- if ( opacity >= 1 || opacity <= 0 ) {
224
+ if ( opacity >= 1 || opacity <= 0 || isNaN ( opacity ) ) {
221
225
clearInterval ( interval ) ;
226
+ console . log ( maxOpacity ) ;
222
227
opacityArray . forEach ( function ( o ) {
223
228
expect ( maxOpacity >= o ) . to . be . ok ( ) ;
224
229
} ) ;
@@ -230,17 +235,20 @@ describe('rc-queue-anim', function () {
230
235
it ( 'should has animating className' , function ( done ) {
231
236
const interval = defaultInterval ;
232
237
instance = createQueueAnimInstance ( ) ;
233
- let children = TestUtils . scryRenderedDOMComponentsWithTag ( instance , 'div' ) ;
234
- expect ( children [ 1 ] . className ) . to . contain ( 'queue-anim-entering' ) ;
235
238
setTimeout ( function ( ) {
236
- expect ( children [ 1 ] . className ) . not . to . contain ( 'queue-anim-entering' ) ;
237
- let removeIndex = instance . removeOne ( ) ;
238
- expect ( children [ removeIndex + 1 ] . className ) . to . contain ( 'queue-anim-leaving' ) ;
239
+ let children = TestUtils . scryRenderedDOMComponentsWithTag ( instance , 'div' ) ;
240
+ expect ( children [ 1 ] . className ) . to . contain ( 'queue-anim-entering' ) ;
239
241
setTimeout ( function ( ) {
240
- expect ( children [ removeIndex + 1 ] . className ) . not . to . contain ( 'queue-anim-leaving' ) ;
241
- done ( ) ;
242
+ expect ( children [ 1 ] . className ) . not . to . contain ( 'queue-anim-entering' ) ;
243
+ let removeIndex = instance . removeOne ( ) ;
244
+ children = TestUtils . scryRenderedDOMComponentsWithTag ( instance , 'div' ) ;
245
+ expect ( children [ removeIndex + 1 ] . className ) . to . contain ( 'queue-anim-leaving' ) ;
246
+ setTimeout ( function ( ) {
247
+ expect ( children [ removeIndex + 1 ] . className ) . not . to . contain ( 'queue-anim-leaving' ) ;
248
+ done ( ) ;
249
+ } , 550 ) ;
242
250
} , 550 ) ;
243
- } , 550 ) ;
251
+ } , 5 ) ;
244
252
} ) ;
245
253
246
254
it ( 'should has animating config is func enter' , function ( done ) {
@@ -253,34 +261,36 @@ describe('rc-queue-anim', function () {
253
261
return { left : [ 100 , 0 ] } ;
254
262
}
255
263
} ) ;
256
- let children = TestUtils . scryRenderedDOMComponentsWithTag ( instance , 'div' ) ;
257
- expect ( isNaN ( getLeft ( children [ 1 ] ) ) ) . to . be . ok ( ) ;
258
- expect ( isNaN ( getTop ( children [ 2 ] ) ) ) . to . be . ok ( ) ;
259
- setTimeout ( function ( ) {
260
- children = TestUtils . scryRenderedDOMComponentsWithTag ( instance , 'div' ) ;
261
- expect ( getLeft ( children [ 1 ] ) ) . to . above ( 0 ) ;
262
- expect ( isNaN ( getTop ( children [ 1 ] ) ) ) . to . be . ok ( ) ;
263
- console . log ( 'left:' , getLeft ( children [ 1 ] ) ) ;
264
+ setTimeout ( function ( ) {
265
+ let children = TestUtils . scryRenderedDOMComponentsWithTag ( instance , 'div' ) ;
266
+ expect ( isNaN ( getLeft ( children [ 1 ] ) ) ) . to . be . ok ( ) ;
267
+ expect ( isNaN ( getTop ( children [ 2 ] ) ) ) . to . be . ok ( ) ;
264
268
setTimeout ( function ( ) {
265
269
children = TestUtils . scryRenderedDOMComponentsWithTag ( instance , 'div' ) ;
266
- expect ( getTop ( children [ 2 ] ) ) . to . above ( 0 ) ;
267
- expect ( isNaN ( getLeft ( children [ 2 ] ) ) ) . to . be . ok ( ) ;
268
- console . log ( 'top :' , getTop ( children [ 2 ] ) ) ;
270
+ expect ( getLeft ( children [ 1 ] ) ) . to . above ( 0 ) ;
271
+ expect ( isNaN ( getTop ( children [ 1 ] ) ) ) . to . be . ok ( ) ;
272
+ console . log ( 'left :' , getLeft ( children [ 1 ] ) ) ;
269
273
setTimeout ( function ( ) {
270
274
children = TestUtils . scryRenderedDOMComponentsWithTag ( instance , 'div' ) ;
271
- expect ( getTop ( children [ 2 ] ) ) . to . be ( 100 ) ;
275
+ expect ( getTop ( children [ 2 ] ) ) . to . above ( 0 ) ;
272
276
expect ( isNaN ( getLeft ( children [ 2 ] ) ) ) . to . be . ok ( ) ;
273
- console . log ( 'top_end:' , getTop ( children [ 2 ] ) ) ;
274
- done ( ) ;
277
+ console . log ( 'top:' , getTop ( children [ 2 ] ) ) ;
278
+ setTimeout ( function ( ) {
279
+ children = TestUtils . scryRenderedDOMComponentsWithTag ( instance , 'div' ) ;
280
+ expect ( getTop ( children [ 2 ] ) ) . to . be ( 100 ) ;
281
+ expect ( isNaN ( getLeft ( children [ 2 ] ) ) ) . to . be . ok ( ) ;
282
+ console . log ( 'top_end:' , getTop ( children [ 2 ] ) ) ;
283
+ done ( ) ;
284
+ } , 500 ) ;
285
+ } , interval ) ;
286
+ setTimeout ( function ( ) {
287
+ children = TestUtils . scryRenderedDOMComponentsWithTag ( instance , 'div' ) ;
288
+ expect ( getLeft ( children [ 1 ] ) ) . to . be ( 100 ) ;
289
+ expect ( isNaN ( getTop ( children [ 1 ] ) ) ) . to . be . ok ( ) ;
290
+ console . log ( 'left_end:' , getLeft ( children [ 1 ] ) ) ;
275
291
} , 500 ) ;
276
- } , interval ) ;
277
- setTimeout ( function ( ) {
278
- children = TestUtils . scryRenderedDOMComponentsWithTag ( instance , 'div' ) ;
279
- expect ( getLeft ( children [ 1 ] ) ) . to . be ( 100 ) ;
280
- expect ( isNaN ( getTop ( children [ 1 ] ) ) ) . to . be . ok ( ) ;
281
- console . log ( 'left_end:' , getLeft ( children [ 1 ] ) ) ;
282
- } , 500 ) ;
283
- } , 10 ) ;
292
+ } , 10 ) ;
293
+ } , 0 ) ;
284
294
} ) ;
285
295
286
296
it ( 'should has animating config is func leave' , function ( done ) {
0 commit comments