Broaden the coverage of isFirstSlide test

If we:
- visit a vertical slide

and then:
- go to the first slide

the function will return **false**.

Added a test to isLastSlide too just to be sure.
edit
fabiano 2014-05-09 12:28:53 -03:00
parent 92fd4f78c8
commit af1ade1418
1 changed files with 14 additions and 0 deletions

View File

@ -68,6 +68,12 @@ Reveal.addEventListener( 'ready', function() {
strictEqual( Reveal.isFirstSlide(), true, 'true after Reveal.slide( 0, 0 )' ); strictEqual( Reveal.isFirstSlide(), true, 'true after Reveal.slide( 0, 0 )' );
}); });
test( 'Reveal.isFirstSlide after vertical slide', function() {
Reveal.slide( 1, 1 );
Reveal.slide( 0, 0 );
strictEqual( Reveal.isFirstSlide(), true, 'true after Reveal.slide( 1, 1 ) and then Reveal.slide( 0, 0 )' );
});
test( 'Reveal.isLastSlide', function() { test( 'Reveal.isLastSlide', function() {
Reveal.slide( 0, 0 ); Reveal.slide( 0, 0 );
strictEqual( Reveal.isLastSlide(), false, 'false after Reveal.slide( 0, 0 )' ); strictEqual( Reveal.isLastSlide(), false, 'false after Reveal.slide( 0, 0 )' );
@ -81,6 +87,14 @@ Reveal.addEventListener( 'ready', function() {
strictEqual( Reveal.isLastSlide(), false, 'false after Reveal.slide( 0, 0 )' ); strictEqual( Reveal.isLastSlide(), false, 'false after Reveal.slide( 0, 0 )' );
}); });
test( 'Reveal.isLastSlide after vertical slide', function() {
var lastSlideIndex = document.querySelectorAll( '.reveal .slides>section' ).length - 1;
Reveal.slide( 1, 1 );
Reveal.slide( lastSlideIndex, 0 );
strictEqual( Reveal.isFirstSlide(), true, 'true after Reveal.slide( 1, 1 ) and then Reveal.slide( '+ lastSlideIndex +', 0 )' );
});
test( 'Reveal.getTotalSlides', function() { test( 'Reveal.getTotalSlides', function() {
strictEqual( Reveal.getTotalSlides(), 8, 'eight slides in total' ); strictEqual( Reveal.getTotalSlides(), 8, 'eight slides in total' );
}); });