@@ -137,10 +137,12 @@ describe('Sticky', function () {
137
137
// Scroll down to 10px, and Sticky should fix
138
138
window . scrollTo ( 0 , 10 ) ;
139
139
shouldBeFixedAt ( inner , 0 ) ;
140
+ expect ( outer . className ) . to . contain ( 'active' ) ;
140
141
141
142
// Scroll up to 0px, and Sticky should reset
142
143
window . scrollTo ( 0 , 0 ) ;
143
144
shouldBeReset ( inner ) ;
145
+ expect ( outer . className ) . to . not . contain ( 'active' ) ;
144
146
} ) ;
145
147
146
148
it ( 'should work as expected (long Sticky)' , function ( ) {
@@ -158,26 +160,32 @@ describe('Sticky', function () {
158
160
// Scroll down to 10px, and Sticky should stay as it was
159
161
window . scrollTo ( 0 , 10 ) ;
160
162
shouldBeReleasedAt ( inner , 0 ) ;
163
+ expect ( outer . className ) . to . not . contain ( 'active' ) ;
161
164
162
165
// Scroll down to 1500px, and Sticky should fix to the bottom
163
166
window . scrollTo ( 0 , 1500 ) ;
164
167
shouldBeFixedAt ( inner , - 432 ) ;
168
+ expect ( outer . className ) . to . contain ( 'active' ) ;
165
169
166
170
// Scroll up to 1300px, and Sticky should release
167
171
window . scrollTo ( 0 , 1300 ) ;
168
172
shouldBeReleasedAt ( inner , 1068 ) ;
173
+ expect ( outer . className ) . to . not . contain ( 'active' ) ;
169
174
170
175
// Scroll down to 1350px, and Sticky should release as it was
171
176
window . scrollTo ( 0 , 1350 ) ;
172
177
shouldBeReleasedAt ( inner , 1068 ) ;
178
+ expect ( outer . className ) . to . not . contain ( 'active' ) ;
173
179
174
180
// Scroll up to 10px, and Sticky should fix
175
181
window . scrollTo ( 0 , 10 ) ;
176
182
shouldBeFixedAt ( inner , 0 ) ;
183
+ expect ( outer . className ) . to . contain ( 'active' ) ;
177
184
178
185
// Scroll down to 20px, and Sticky should release
179
186
window . scrollTo ( 0 , 20 ) ;
180
187
shouldBeReleasedAt ( inner , 10 ) ;
188
+ expect ( outer . className ) . to . not . contain ( 'active' ) ;
181
189
} ) ;
182
190
183
191
it ( 'should work as expected with original postion 20px from top (short Sticky)' , function ( ) {
@@ -195,10 +203,12 @@ describe('Sticky', function () {
195
203
// Scroll down to 10px, and Sticky should stay
196
204
window . scrollTo ( 0 , 10 ) ;
197
205
shouldBeReset ( inner ) ;
206
+ expect ( outer . className ) . to . not . contain ( 'active' ) ;
198
207
199
208
// Scroll down to 50px, and Sticky should fix
200
209
window . scrollTo ( 0 , 50 ) ;
201
210
shouldBeFixedAt ( inner , 0 ) ;
211
+ expect ( outer . className ) . to . contain ( 'active' ) ;
202
212
} ) ;
203
213
204
214
it ( 'should work as expected with original top 20px and 400px bottom boundary (short Sticky)' , function ( ) {
@@ -218,14 +228,17 @@ describe('Sticky', function () {
218
228
// Scroll down to 10px, and Sticky should stay
219
229
window . scrollTo ( 0 , 10 ) ;
220
230
shouldBeReset ( inner ) ;
231
+ expect ( outer . className ) . to . not . contain ( 'active' ) ;
221
232
222
233
// Scroll down to 50px, and Sticky should fix
223
234
window . scrollTo ( 0 , 50 ) ;
224
235
shouldBeFixedAt ( inner , 0 ) ;
236
+ expect ( outer . className ) . to . contain ( 'active' ) ;
225
237
226
238
// Scroll down to 150px, and Sticky should release
227
239
window . scrollTo ( 0 , 150 ) ;
228
240
shouldBeReleasedAt ( inner , 80 ) ;
241
+ expect ( outer . className ) . to . not . contain ( 'active' ) ;
229
242
} ) ;
230
243
231
244
it ( 'should not be sticky if bottom boundary is shorter then its height (short Sticky)' , function ( ) {
@@ -244,11 +257,13 @@ describe('Sticky', function () {
244
257
// Scroll down to 10px, and Sticky should stay
245
258
window . scrollTo ( 0 , 10 ) ;
246
259
shouldBeReset ( inner ) ;
260
+ expect ( outer . className ) . to . not . contain ( 'active' ) ;
247
261
248
262
// Micic status was not 0 (STATUS_ORIGINAL), scroll down to 20px, and Sticky should stay
249
263
sticky . state . status = 2 ; // STATUS_FIXED;
250
264
window . scrollTo ( 0 , 20 ) ;
251
265
shouldBeReset ( inner ) ;
266
+ expect ( outer . className ) . to . not . contain ( 'active' ) ;
252
267
} ) ;
253
268
254
269
it ( 'should work as expected with selector bottom boundary (short Sticky)' , function ( ) {
@@ -268,14 +283,17 @@ describe('Sticky', function () {
268
283
// Scroll down to 10px, and Sticky should fix
269
284
window . scrollTo ( 0 , 10 ) ;
270
285
shouldBeFixedAt ( inner , 20 ) ;
286
+ expect ( outer . className ) . to . contain ( 'active' ) ;
271
287
272
288
// Scroll down to 50px, and Sticky should fix
273
289
window . scrollTo ( 0 , 50 ) ;
274
290
shouldBeFixedAt ( inner , 20 ) ;
291
+ expect ( outer . className ) . to . contain ( 'active' ) ;
275
292
276
293
// Scroll down to 150px, and Sticky should release
277
294
window . scrollTo ( 0 , 150 ) ;
278
295
shouldBeReleasedAt ( inner , 100 ) ;
296
+ expect ( outer . className ) . to . not . contain ( 'active' ) ;
279
297
} ) ;
280
298
281
299
it ( 'should stick to the top when window resizes larger then Sticky (long Sticky)' , function ( ) {
@@ -293,8 +311,10 @@ describe('Sticky', function () {
293
311
// Scroll down to 10px, and Sticky should fix
294
312
window . scrollTo ( 0 , 10 ) ;
295
313
shouldBeReleasedAt ( inner , 0 ) ;
314
+ expect ( outer . className ) . to . not . contain ( 'active' ) ;
296
315
297
316
window . resizeTo ( 0 , 900 ) ;
298
317
shouldBeFixedAt ( inner , 0 ) ;
318
+ expect ( outer . className ) . to . contain ( 'active' ) ;
299
319
} ) ;
300
320
} ) ;
0 commit comments