@@ -8,43 +8,43 @@ describe('lory()', function () {
88 var slideMargin = 10 ;
99 var transitionEnd = whichTransitionEndProp ( ) ;
1010
11- function whichTransitionEndProp ( ) {
11+ function whichTransitionEndProp ( ) {
1212 var el = document . createElement ( 'fakeelement' ) ;
1313 var transitionEndProps = {
1414 'transition' : 'transitionend' ,
1515 'OTransition' : 'oTransitionEnd' ,
1616 'MozTransition' : 'transitionend' ,
1717 'WebkitTransition' : 'webkitTransitionEnd'
18- }
18+ } ;
1919 for ( var transition in transitionEndProps ) {
2020 if ( el . style [ transition ] !== undefined ) {
2121 return transitionEndProps [ transition ] ;
2222 }
2323 }
2424 }
2525
26- function waitForTransitionEnd ( fn , done ) {
26+ function waitForTransitionEnd ( fn , done ) {
2727 var slideContainer = getSlideContainer ( ) ;
28- var listener = function ( ) {
28+ var listener = function ( ) {
2929 fn ( ) ;
3030 slideContainer . removeEventListener ( transitionEnd , listener ) ;
3131 done && done ( ) ;
3232 } ;
3333 slideContainer . addEventListener ( transitionEnd , listener ) ;
3434 }
3535
36- function getSlideContainer ( ) {
36+ function getSlideContainer ( ) {
3737 return element . querySelector ( '.js_slides' ) ;
3838 }
3939
40- function getActualOffset ( ) {
40+ function getActualOffset ( ) {
4141 var slideContainer = getSlideContainer ( ) ;
4242 var parentOffset = slideContainer . offsetParent . getBoundingClientRect ( ) . left ;
4343 var elementOffset = slideContainer . getBoundingClientRect ( ) . left ;
4444 return ( parentOffset - elementOffset ) * - 1 ;
4545 }
4646
47- function getExpectedOffset ( leftOffsetSlideCount ) {
47+ function getExpectedOffset ( leftOffsetSlideCount ) {
4848 var slideWidth = element . querySelector ( '.js_slide' ) . offsetWidth ;
4949 return ( slideWidth + slideMargin ) * - leftOffsetSlideCount ;
5050 }
@@ -55,7 +55,7 @@ describe('lory()', function () {
5555
5656 beforeEach ( function ( ) {
5757 this . result = fixture . load ( 'test.html' ) ;
58- element = fixture . el . querySelector ( '.js_simple' ) ;
58+ element = fixture . el . querySelector ( '.js_simple' ) ;
5959 } ) ;
6060
6161 it ( 'has to be a function' , function ( ) {
@@ -137,16 +137,16 @@ describe('lory()', function () {
137137 assert . typeOf ( instance . next , 'function' ) ;
138138 } ) ;
139139
140- describe ( 'called 2x' , function ( ) {
140+ describe ( 'called 2x' , function ( ) {
141141 var expectedIndex = 2 ;
142142
143143 beforeEach ( function ( ) {
144144 instance . next ( ) ;
145145 instance . next ( ) ;
146146 } ) ;
147147
148- it ( 'translates the slides container 2 slides to the left' , function ( done ) {
149- waitForTransitionEnd ( function ( ) {
148+ it ( 'translates the slides container 2 slides to the left' , function ( done ) {
149+ waitForTransitionEnd ( function ( ) {
150150 assert . equal ( getActualOffset ( ) , getExpectedOffset ( 2 ) ) ;
151151 } , done ) ;
152152 } ) ;
@@ -159,15 +159,15 @@ describe('lory()', function () {
159159 describe ( 'without infinite' , function ( ) {
160160 var expectedIndex = 5 ;
161161
162- describe ( 'called 6x' , function ( ) {
162+ describe ( 'called 6x' , function ( ) {
163163 beforeEach ( function ( ) {
164164 for ( var i = 0 ; i < 6 ; i += 1 ) {
165165 instance . next ( ) ;
166166 }
167167 } ) ;
168168
169- it ( 'translates the slides container 5 slides to the left' , function ( done ) {
170- waitForTransitionEnd ( function ( ) {
169+ it ( 'translates the slides container 5 slides to the left' , function ( done ) {
170+ waitForTransitionEnd ( function ( ) {
171171 assert . equal ( getActualOffset ( ) , getExpectedOffset ( 5 ) ) ;
172172 } , done ) ;
173173 } ) ;
@@ -185,7 +185,7 @@ describe('lory()', function () {
185185 } ) ;
186186 } ) ;
187187
188- describe ( 'called 6x' , function ( ) {
188+ describe ( 'called 6x' , function ( ) {
189189 var expectedIndex = 0 ;
190190
191191 beforeEach ( function ( ) {
@@ -194,8 +194,8 @@ describe('lory()', function () {
194194 }
195195 } ) ;
196196
197- it ( 'translates the slides container 1 slide to the left' , function ( done ) {
198- waitForTransitionEnd ( function ( ) {
197+ it ( 'translates the slides container 1 slide to the left' , function ( done ) {
198+ waitForTransitionEnd ( function ( ) {
199199 assert . equal ( getActualOffset ( ) , getExpectedOffset ( 1 ) ) ;
200200 } , done ) ;
201201 } ) ;
@@ -207,7 +207,7 @@ describe('lory()', function () {
207207 } ) ;
208208 } ) ;
209209
210- describe ( '.prev()' , function ( ) {
210+ describe ( '.prev()' , function ( ) {
211211 beforeEach ( function ( ) {
212212 instance = lory ( element ) ;
213213 } ) ;
@@ -224,11 +224,11 @@ describe('lory()', function () {
224224 instance . prev ( ) ;
225225 } ) ;
226226
227- it ( 'does not translate the slides container' , function ( ) {
227+ it ( 'does not translate the slides container' , function ( ) {
228228 assert . equal ( getActualOffset ( ) , getExpectedOffset ( 0 ) ) ;
229229 } ) ;
230230
231- it ( 'index has to be 0 (i.e. 1st slide)' , function ( ) {
231+ it ( 'index has to be 0 (i.e. 1st slide)' , function ( ) {
232232 assert . equal ( instance . returnIndex ( ) , 0 ) ;
233233 } ) ;
234234 } ) ;
@@ -240,19 +240,19 @@ describe('lory()', function () {
240240 instance . next ( ) ;
241241 // setTimeout is needed to simulate two separate clicks,
242242 // otherwise the two transitions cancel each other out
243- window . setTimeout ( function ( ) {
243+ window . setTimeout ( function ( ) {
244244 instance . prev ( ) ;
245245 done ( ) ;
246246 } , 50 ) ;
247247 } ) ;
248248
249- it ( 'translates the slides container back to the first slide' , function ( done ) {
250- waitForTransitionEnd ( function ( ) {
249+ it ( 'translates the slides container back to the first slide' , function ( done ) {
250+ waitForTransitionEnd ( function ( ) {
251251 assert . equal ( getActualOffset ( ) , getExpectedOffset ( 0 ) ) ;
252252 } , done ) ;
253253 } ) ;
254254
255- it ( 'index has to be 0 (i.e. 1st slide)' , function ( ) {
255+ it ( 'index has to be 0 (i.e. 1st slide)' , function ( ) {
256256 assert . equal ( instance . returnIndex ( ) , expectedIndex ) ;
257257 } ) ;
258258 } ) ;
@@ -266,13 +266,13 @@ describe('lory()', function () {
266266 instance . prev ( ) ;
267267 } ) ;
268268
269- it ( 'translates the slides container 1 slide to the left' , function ( done ) {
270- waitForTransitionEnd ( function ( ) {
269+ it ( 'translates the slides container 1 slide to the left' , function ( done ) {
270+ waitForTransitionEnd ( function ( ) {
271271 assert . equal ( getActualOffset ( ) , getExpectedOffset ( 1 ) ) ;
272272 } , done ) ;
273273 } ) ;
274274
275- it ( 'index has to be 1 (i.e. 2nd slide)' , function ( ) {
275+ it ( 'index has to be 1 (i.e. 2nd slide)' , function ( ) {
276276 assert . equal ( instance . returnIndex ( ) , expectedIndex ) ;
277277 } ) ;
278278 } ) ;
@@ -285,37 +285,37 @@ describe('lory()', function () {
285285 } ) ;
286286 } ) ;
287287
288- describe ( 'called zero times' , function ( ) {
288+ describe ( 'called zero times' , function ( ) {
289289 var expectedIndex = 0 ;
290290
291- it ( 'translates the slides container 1 slide to the left' , function ( ) {
291+ it ( 'translates the slides container 1 slide to the left' , function ( ) {
292292 assert . equal ( getActualOffset ( ) , getExpectedOffset ( 1 ) ) ;
293293 } ) ;
294294
295- it ( 'index has to be 0 (i.e. 1st slide)' , function ( ) {
295+ it ( 'index has to be 0 (i.e. 1st slide)' , function ( ) {
296296 assert . equal ( instance . returnIndex ( ) , expectedIndex ) ;
297297 } ) ;
298298 } ) ;
299299
300- describe ( 'called once' , function ( ) {
300+ describe ( 'called once' , function ( ) {
301301 var expectedIndex = 5 ;
302302
303303 beforeEach ( function ( ) {
304304 instance . prev ( ) ;
305305 } ) ;
306306
307- it ( 'translates the slides container 6 slides to the left' , function ( done ) {
308- waitForTransitionEnd ( function ( ) {
307+ it ( 'translates the slides container 6 slides to the left' , function ( done ) {
308+ waitForTransitionEnd ( function ( ) {
309309 assert . equal ( getActualOffset ( ) , getExpectedOffset ( 6 ) ) ;
310310 } , done ) ;
311311 } ) ;
312312
313- it ( 'index has to be 5 (i.e. 6th slide)' , function ( ) {
313+ it ( 'index has to be 5 (i.e. 6th slide)' , function ( ) {
314314 assert . equal ( instance . returnIndex ( ) , expectedIndex ) ;
315315 } ) ;
316316 } ) ;
317317
318- describe ( 'called 4x' , function ( ) {
318+ describe ( 'called 4x' , function ( ) {
319319 var expectedIndex = 2 ;
320320
321321 beforeEach ( function ( ) {
@@ -324,13 +324,13 @@ describe('lory()', function () {
324324 }
325325 } ) ;
326326
327- it ( 'translates the slides container 3 slides to the left' , function ( done ) {
328- waitForTransitionEnd ( function ( ) {
327+ it ( 'translates the slides container 3 slides to the left' , function ( done ) {
328+ waitForTransitionEnd ( function ( ) {
329329 assert . equal ( getActualOffset ( ) , getExpectedOffset ( 3 ) ) ;
330330 } , done ) ;
331331 } ) ;
332332
333- it ( 'index has to be 2 (i.e. 3rd slide)' , function ( ) {
333+ it ( 'index has to be 2 (i.e. 3rd slide)' , function ( ) {
334334 assert . equal ( instance . returnIndex ( ) , expectedIndex ) ;
335335 } ) ;
336336 } ) ;
@@ -343,18 +343,18 @@ describe('lory()', function () {
343343 } ) ;
344344 } ) ;
345345
346- describe ( 'called once' , function ( ) {
346+ describe ( 'called once' , function ( ) {
347347 var expectedIndex = 2 ;
348348
349349 beforeEach ( function ( ) {
350350 instance . prev ( ) ;
351351 } ) ;
352352
353- it ( 'index has to be 2 (one less than initialIndex)' , function ( ) {
353+ it ( 'index has to be 2 (one less than initialIndex)' , function ( ) {
354354 assert . equal ( instance . returnIndex ( ) , expectedIndex ) ;
355355 } ) ;
356- } ) ;
357- } ) ;
356+ } ) ;
357+ } ) ;
358358 } ) ;
359359
360360 describe ( '.destroy()' , function ( ) {
@@ -366,35 +366,4 @@ describe('lory()', function () {
366366 assert . typeOf ( instance . destroy , 'function' ) ;
367367 } ) ;
368368 } ) ;
369-
370- describe ( '.onResize()' , function ( ) {
371- var resizeListener ;
372- var indexAfterResize ;
373- var onResizeCallback = function ( ) {
374- indexAfterResize = instance . returnIndex ( ) ;
375- } ;
376-
377- beforeEach ( function ( ) {
378- instance = lory ( element , {
379- window : {
380- addEventListener : function ( type , listener ) {
381- if ( type == 'resize' ) {
382- resizeListener = listener ;
383- }
384- }
385- }
386- } ) ;
387- element . addEventListener ( 'on.lory.resize' , onResizeCallback ) ;
388- } ) ;
389-
390- afterEach ( function ( ) {
391- element . removeEventListener ( 'on.lory.resize' , onResizeCallback ) ;
392- } ) ;
393-
394- it ( 'has to dispatch the event on.lory.resize after reset()' , function ( ) {
395- instance . next ( ) ;
396- resizeListener ( ) ;
397- assert . equal ( indexAfterResize , 0 ) ;
398- } ) ;
399- } ) ;
400369} ) ;
0 commit comments