File tree 2 files changed +31
-2
lines changed
2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -205,12 +205,17 @@ describe 'WOW', ->
205
205
206
206
describe ' library behaviour with custom settings' , ->
207
207
208
+ called = false
209
+
208
210
beforeEach (done ) ->
211
+ called = false
209
212
loadFixtures ' custom.html'
210
213
new WOW
211
214
boxClass : ' block'
212
215
animateClass : ' fancy'
213
216
offset : 10
217
+ callback : ->
218
+ called = true
214
219
.init ()
215
220
setTimeout ->
216
221
done ()
@@ -293,3 +298,13 @@ describe 'WOW', ->
293
298
done ()
294
299
, timeout
295
300
, timeout
301
+
302
+ it " fires the callback" , (done ) ->
303
+ called = false # reset
304
+ # Scroll down so that 150px of #custom-3 becomes visible.
305
+ window .scrollTo 0 , $ (' #custom-3' ).offset ().top - winHeight + 150
306
+ setTimeout ->
307
+ expect called
308
+ .toBe true
309
+ done ()
310
+ , timeout
Original file line number Diff line number Diff line change 140
140
} ) ;
141
141
} ) ;
142
142
return describe ( 'library behaviour with custom settings' , function ( ) {
143
+ var called ;
144
+ called = false ;
143
145
beforeEach ( function ( done ) {
146
+ called = false ;
144
147
loadFixtures ( 'custom.html' ) ;
145
148
new WOW ( {
146
149
boxClass : 'block' ,
147
150
animateClass : 'fancy' ,
148
- offset : 10
151
+ offset : 10 ,
152
+ callback : function ( ) {
153
+ return called = true ;
154
+ }
149
155
} ) . init ( ) ;
150
156
return setTimeout ( function ( ) {
151
157
return done ( ) ;
190
196
expect ( $ ( '#custom-3' ) ) . not . toHaveClass ( 'fancy' ) ;
191
197
return expect ( $ ( '#custom-4' ) ) . not . toHaveClass ( 'fancy' ) ;
192
198
} ) ;
193
- return it ( 'animates elements after scrolling down and they become visible' , function ( done ) {
199
+ it ( 'animates elements after scrolling down and they become visible' , function ( done ) {
194
200
window . scrollTo ( 0 , $ ( '#custom-3' ) . offset ( ) . top - winHeight + 150 ) ;
195
201
return setTimeout ( function ( ) {
196
202
expect ( $ ( '#custom-3' ) ) . toHaveClass ( 'fancy' ) ;
208
214
} , timeout ) ;
209
215
} , timeout ) ;
210
216
} ) ;
217
+ return it ( "fires the callback" , function ( done ) {
218
+ called = false ;
219
+ window . scrollTo ( 0 , $ ( '#custom-3' ) . offset ( ) . top - winHeight + 150 ) ;
220
+ return setTimeout ( function ( ) {
221
+ expect ( called ) . toBe ( true ) ;
222
+ return done ( ) ;
223
+ } , timeout ) ;
224
+ } ) ;
211
225
} ) ;
212
226
} ) ;
213
227
You can’t perform that action at this time.
0 commit comments