diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2013-11-23 17:13:14 -0500 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2013-11-23 17:13:14 -0500 |
commit | ef82645589dd265e6fc611d17388396f11279751 (patch) | |
tree | 547756dcc94c61d61917627435029ee386e25fb1 /test | |
parent | ead723bc1cf29aec844b19d1e3882dde9ab57fd3 (diff) | |
download | fosdem-2018-presentation-ef82645589dd265e6fc611d17388396f11279751.tar fosdem-2018-presentation-ef82645589dd265e6fc611d17388396f11279751.tar.gz |
remove current-fragment when leaving slide, add tests for current fragment
Diffstat (limited to 'test')
-rw-r--r-- | test/test.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/test.js b/test/test.js index 3570d78..5974e3e 100644 --- a/test/test.js +++ b/test/test.js @@ -166,6 +166,9 @@ Reveal.addEventListener( 'ready', function() { QUnit.module( 'Fragments' ); test( 'Sliding to fragments', function() { + Reveal.slide( 2, 0, -1 ); + deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: -1 }, 'Reveal.slide( 2, 0, -1 )' ); + Reveal.slide( 2, 0, 0 ); deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 0 }, 'Reveal.slide( 2, 0, 0 )' ); @@ -176,6 +179,32 @@ Reveal.addEventListener( 'ready', function() { deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 1 }, 'Reveal.slide( 2, 0, 1 )' ); }); + test( 'Hiding all fragments', function() { + var fragmentSlide = document.querySelector( '.reveal .slides>section:nth-child(3)' ); + + Reveal.slide( 2, 0, 0 ); + strictEqual( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 1, 'one fragment visible when index is 0' ); + + Reveal.slide( 2, 0, -1 ); + strictEqual( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 0, 'no fragments visible when index 0' ); + }); + + test( 'Current fragment', function() { + var fragmentSlide = document.querySelector( '.reveal .slides>section:nth-child(3)' ); + + Reveal.slide( 2, 0 ); + strictEqual( fragmentSlide.querySelectorAll( '.fragment.current-fragment' ).length, 0, 'no current fragment at index -1' ); + + Reveal.slide( 2, 0, 0 ); + strictEqual( fragmentSlide.querySelectorAll( '.fragment.current-fragment' ).length, 1, 'one current fragment at index 0' ); + + Reveal.slide( 1, 0, 0 ); + strictEqual( fragmentSlide.querySelectorAll( '.fragment.current-fragment' ).length, 0, 'no current fragment when navigating to previous slide' ); + + Reveal.slide( 3, 0, 0 ); + strictEqual( fragmentSlide.querySelectorAll( '.fragment.current-fragment' ).length, 0, 'no current fragment when navigating to next slide' ); + }); + test( 'Stepping through fragments', function() { Reveal.slide( 2, 0, -1 ); |