Merge branch 'fix-isFirstSlide' of https://github.com/fabianorosas/reveal.js into dev
This commit is contained in:
commit
b9d25057d6
@ -3909,7 +3909,7 @@
|
|||||||
|
|
||||||
// Returns true if we're currently on the first slide
|
// Returns true if we're currently on the first slide
|
||||||
isFirstSlide: function() {
|
isFirstSlide: function() {
|
||||||
return document.querySelector( SLIDES_SELECTOR + '.past' ) == null ? true : false;
|
return ( indexh === 0 && indexv === 0 );
|
||||||
},
|
},
|
||||||
|
|
||||||
// Returns true if we're currently on the last slide
|
// Returns true if we're currently on the last slide
|
||||||
|
16
test/test.js
16
test/test.js
@ -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 )' );
|
||||||
@ -75,12 +81,20 @@ Reveal.addEventListener( 'ready', function() {
|
|||||||
var lastSlideIndex = document.querySelectorAll( '.reveal .slides>section' ).length - 1;
|
var lastSlideIndex = document.querySelectorAll( '.reveal .slides>section' ).length - 1;
|
||||||
|
|
||||||
Reveal.slide( lastSlideIndex, 0 );
|
Reveal.slide( lastSlideIndex, 0 );
|
||||||
strictEqual( Reveal.isLastSlide(), true, 'true after Reveal.slide( ', 0+ lastSlideIndex +' )' );
|
strictEqual( Reveal.isLastSlide(), true, 'true after Reveal.slide( '+ lastSlideIndex +', 0 )' );
|
||||||
|
|
||||||
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 )' );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test( 'Reveal.isLastSlide after vertical slide', function() {
|
||||||
|
var lastSlideIndex = document.querySelectorAll( '.reveal .slides>section' ).length - 1;
|
||||||
|
|
||||||
|
Reveal.slide( 1, 1 );
|
||||||
|
Reveal.slide( lastSlideIndex );
|
||||||
|
strictEqual( Reveal.isLastSlide(), 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' );
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user