aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2020-02-11 15:31:17 +0100
committerHakim El Hattab <hakim.elhattab@gmail.com>2020-02-11 15:31:17 +0100
commitea295796eab7661c1e2050d3442e53a44d02ad88 (patch)
treea4316aadb78bbd84a3881222c76b79ec6b20d448 /test
parent6e4c36b3db438f23d697eb8cc28f3c29f8b665b2 (diff)
downloadfosdem-2021-minimalism-presentation-ea295796eab7661c1e2050d3442e53a44d02ad88.tar
fosdem-2021-minimalism-presentation-ea295796eab7661c1e2050d3442e53a44d02ad88.tar.gz
refactoring and fixed auto-animate test exception
Diffstat (limited to 'test')
-rw-r--r--test/examples/auto-animate.html2
-rw-r--r--test/test-auto-animate.html45
2 files changed, 25 insertions, 22 deletions
diff --git a/test/examples/auto-animate.html b/test/examples/auto-animate.html
index 7603ecb..b8fca80 100644
--- a/test/examples/auto-animate.html
+++ b/test/examples/auto-animate.html
@@ -30,7 +30,7 @@ function Example() {
</code></pre>
</section>
<section data-auto-animate data-auto-animate-unmatched="fade">
- <h3 data-auto-animate-delay="1">Auto-Matched Content (no IDs)</h3>
+ <h3>Auto-Matched Content (no IDs)</h3>
<p style="opacity: 0.2; margin-top: 200px;">This will fade out</p>
<p>This element is unmatched</p>
<img src="assets/image1.png" style="height: 100px;">
diff --git a/test/test-auto-animate.html b/test/test-auto-animate.html
index 2d75710..6e3080d 100644
--- a/test/test-auto-animate.html
+++ b/test/test-auto-animate.html
@@ -45,20 +45,19 @@
<script src="qunit-2.5.0.js"></script>
<script>
- window.externalScriptSequence = '';
+
+ const slides = [].slice.call( document.querySelectorAll( '.slides section' ) ).map( slide => {
+ return {
+ h1: slide.querySelector( 'h1' ),
+ h2: slide.querySelector( 'h2' ),
+ h3: slide.querySelector( 'h3' )
+ };
+ } );
Reveal.addEventListener( 'ready', () => {
QUnit.module( 'Auto-Animate' );
- const slides = [].slice.call( document.querySelectorAll( '.slides section' ) ).map( slide => {
- return {
- h1: slide.querySelector( 'h1' ),
- h2: slide.querySelector( 'h2' ),
- h3: slide.querySelector( 'h3' )
- };
- } );
-
QUnit.test( 'Adds data-auto-animate-target', assert => {
Reveal.slide(1);
assert.strictEqual( slides[0].h1.getAttribute( 'data-auto-animate-target' ), '', 'From elements have blank data-auto-animate-target' );
@@ -72,27 +71,31 @@
});
QUnit.test( 'Slide specific data-auto-animate-duration', assert => {
- assert.timeout( 350 );
- var done = assert.async();
+ 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', function() {
- assert.ok( true, 'Transition ended within time window' );
- done();
- } );
+ slides[2].h3.addEventListener( 'transitionend', callback );
});
QUnit.test( 'Element specific data-auto-animate-duration', assert => {
- assert.timeout( 350 );
- var done = assert.async();
+ 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', function() {
- assert.ok( true, 'Transition ended within time window' );
- done();
- } );
+ slides[1].h1.addEventListener( 'transitionend', callback );
});
} );