From 92fd4f78c86ea296ceb90c748f088674a5a12c5f Mon Sep 17 00:00:00 2001 From: fabiano Date: Fri, 9 May 2014 11:51:55 -0300 Subject: [PATCH 1/5] Small typo --- test/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test.js b/test/test.js index 00f90809..7406aea1 100644 --- a/test/test.js +++ b/test/test.js @@ -75,7 +75,7 @@ Reveal.addEventListener( 'ready', function() { var lastSlideIndex = document.querySelectorAll( '.reveal .slides>section' ).length - 1; 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 ); strictEqual( Reveal.isLastSlide(), false, 'false after Reveal.slide( 0, 0 )' ); From af1ade14187c50a0e8d7ca954dfd1ae7d3043456 Mon Sep 17 00:00:00 2001 From: fabiano Date: Fri, 9 May 2014 12:28:53 -0300 Subject: [PATCH 2/5] 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. --- test/test.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/test.js b/test/test.js index 7406aea1..fd7b8656 100644 --- a/test/test.js +++ b/test/test.js @@ -68,6 +68,12 @@ Reveal.addEventListener( 'ready', function() { 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() { 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 )' ); }); + 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() { strictEqual( Reveal.getTotalSlides(), 8, 'eight slides in total' ); }); From d072be2f573fe532f95907dc02c85b224b64819d Mon Sep 17 00:00:00 2001 From: fabiano Date: Fri, 9 May 2014 14:23:25 -0300 Subject: [PATCH 3/5] kill-yank mistake --- test/test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test.js b/test/test.js index fd7b8656..6c7270f2 100644 --- a/test/test.js +++ b/test/test.js @@ -91,8 +91,8 @@ Reveal.addEventListener( 'ready', 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 )' ); + Reveal.slide( lastSlideIndex ); + strictEqual( Reveal.isLastSlide(), true, 'true after Reveal.slide( 1, 1 ) and then Reveal.slide( '+ lastSlideIndex +', 0 )' ); }); test( 'Reveal.getTotalSlides', function() { From cb4fe35bac514fcacf98b76f094071b9d50a722b Mon Sep 17 00:00:00 2001 From: fabiano Date: Fri, 9 May 2014 15:58:56 -0300 Subject: [PATCH 4/5] fixed a problem in the function isFirstSlide when visiting a vertical slide and then going back to the first slide, the function would return false. made it more fail proof by checking the indices directly. --- js/reveal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/reveal.js b/js/reveal.js index da437388..3bd75a29 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -3902,7 +3902,7 @@ // Returns true if we're currently on the first slide 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 From ffecac6df30b00cf35588a00299b610b76a953f2 Mon Sep 17 00:00:00 2001 From: fabiano Date: Fri, 9 May 2014 16:11:04 -0300 Subject: [PATCH 5/5] == --> === --- js/reveal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/reveal.js b/js/reveal.js index 3bd75a29..dd2f990e 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -3902,7 +3902,7 @@ // Returns true if we're currently on the first slide isFirstSlide: function() { - return ( indexh == 0 && indexv == 0 ); + return ( indexh === 0 && indexv === 0 ); }, // Returns true if we're currently on the last slide