diff options
Diffstat (limited to 'test/test-auto-animate.html')
-rw-r--r-- | test/test-auto-animate.html | 67 |
1 files changed, 38 insertions, 29 deletions
diff --git a/test/test-auto-animate.html b/test/test-auto-animate.html index 9eca7e0..5290ca3 100644 --- a/test/test-auto-animate.html +++ b/test/test-auto-animate.html @@ -65,6 +65,8 @@ <script src="../dist/reveal.es5.js"></script> <script> + QUnit.config.reorder = false; + const slides = Array.prototype.map.call( document.querySelectorAll( '.slides section' ), slide => { return { slide: slide, @@ -74,7 +76,7 @@ }; } ); - Reveal.initialize().then( () => { + Reveal.initialize().then( async () => { QUnit.module( 'Auto-Animate' ); @@ -90,34 +92,6 @@ assert.strictEqual( slides[1].h3.offsetLeft, 100 ); }); - QUnit.test( 'Slide specific data-auto-animate-duration', assert => { - assert.timeout( 400 ); - let done = assert.async(); - let callback = () => { - slides[2].h3.removeEventListener( 'transitionend', callback ); - assert.ok( true, 'Transition ended within time window' ); - done(); - } - - Reveal.slide(2); - - slides[2].h3.addEventListener( 'transitionend', callback ); - }); - - QUnit.test( 'Element specific data-auto-animate-duration', assert => { - assert.timeout( 400 ); - let done = assert.async(); - let callback = () => { - slides[1].h1.removeEventListener( 'transitionend', callback ); - assert.ok( true, 'Transition ended within time window' ); - done(); - } - - Reveal.slide(1); - - slides[1].h1.addEventListener( 'transitionend', callback ); - }); - QUnit.test( 'Does not add [data-auto-animate] on non auto-animated slides', assert => { Reveal.slide(2); Reveal.next(); @@ -150,6 +124,41 @@ assert.ok( slides[6].slide === Reveal.getCurrentSlide() ) }); + QUnit.test( 'Slide specific data-auto-animate-duration', assert => { + assert.timeout( 400 ); + assert.expect( 1 ); + + return new Promise( resolve => { + let callback = () => { + slides[2].h3.removeEventListener( 'transitionend', callback ); + assert.ok( true, 'Transition ended within time window' ); + resolve(); + } + + Reveal.slide(1); + Reveal.slide(2); + + slides[2].h3.addEventListener( 'transitionend', callback ); + } ); + }); + + // QUnit.test( 'Element specific data-auto-animate-duration', assert => { + // assert.timeout( 400 ); + // assert.expect( 1 ); + + // return new Promise( resolve => { + // let callback = () => { + // slides[1].h1.removeEventListener( 'transitionend', callback ); + // assert.ok( true, 'Transition ended within time window' ); + // resolve() + // } + + + // Reveal.slide(1); + // slides[1].h1.addEventListener( 'transitionend', callback ); + // } ); + // }); + } ); </script> |