|
@@ -18,12 +18,18 @@ describe( 'Controller#go()', () => {
|
|
|
expect( splide.index ).toBe( 0 );
|
|
|
} );
|
|
|
|
|
|
- test( 'can loop the slider, using the end index.', () => {
|
|
|
- // The end index is 1.
|
|
|
- const splide = init( { rewind: true, perPage: 3, speed: 0 }, { length: 4 } );
|
|
|
+ test( 'can loop the slider, using the index of the last page.', () => {
|
|
|
+ // The length is 10 and the last page only contains the slide 9.
|
|
|
+ const splide = init( { type: 'loop', perPage: 3, speed: 0 } );
|
|
|
|
|
|
splide.go( '<' );
|
|
|
- expect( splide.index ).toBe( 1 );
|
|
|
+ expect( splide.index ).toBe( 9 ); // 9, 0, 1
|
|
|
+
|
|
|
+ splide.go( '<' );
|
|
|
+ expect( splide.index ).toBe( 6 ); // 6, 7, 8
|
|
|
+
|
|
|
+ splide.go( '>' );
|
|
|
+ expect( splide.index ).toBe( 7 ); // 7, 8, 9
|
|
|
|
|
|
splide.go( '>' );
|
|
|
expect( splide.index ).toBe( 0 );
|