diff options
author | Hakim El Hattab | 2020-01-15 11:37:37 +0100 |
---|---|---|
committer | Hakim El Hattab | 2020-01-15 11:37:37 +0100 |
commit | ac5075352163e4d5806db95f936372658f12d04f (patch) | |
tree | 1cee2005f9215b0a9f5adfe44a580be3b1a456f1 /test | |
parent | 76187bc666fcea9d3c3aae82c49c9100d4242f9d (diff) |
add data-fragment=<index> attribute to slide <sections>
Diffstat (limited to 'test')
-rw-r--r-- | test/test.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test.js b/test/test.js index 2738403..14bb690 100644 --- a/test/test.js +++ b/test/test.js @@ -250,6 +250,22 @@ Reveal.addEventListener( 'ready', function() { assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 1 }, 'Reveal.slide( 2, 0, 1 )' ); }); + QUnit.test( 'data-fragment is set on slide <section>', function( assert ) { + Reveal.slide( 2, 0, -1 ); + assert.deepEqual( Reveal.getCurrentSlide().getAttribute( 'data-fragment' ), '-1' ); + + Reveal.slide( 2, 0, 2 ); + assert.deepEqual( Reveal.getCurrentSlide().getAttribute( 'data-fragment' ), '2' ); + + Reveal.slide( 2, 0, 0 ); + assert.deepEqual( Reveal.getCurrentSlide().getAttribute( 'data-fragment' ), '0' ); + + var fragmentSlide = Reveal.getCurrentSlide(); + + Reveal.slide( 3, 0 ); + assert.deepEqual( fragmentSlide.getAttribute( 'data-fragment' ), '0', 'data-fragment persists when jumping to another slide' ); + }); + QUnit.test( 'Hiding all fragments', function( assert ) { var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(1)' ); |