aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2013-12-21 18:08:40 +0100
committerHakim El Hattab <hakim.elhattab@gmail.com>2013-12-21 18:08:40 +0100
commit942154182562b6c80bb9b536d24b1d8bd947452c (patch)
tree0c6bcd8f6900eff1ee2505cc3a6f07861572474e
parenta97d73167d4dc52738e01f5ca5f2de74902276b6 (diff)
downloadfosdem-2018-presentation-942154182562b6c80bb9b536d24b1d8bd947452c.tar
fosdem-2018-presentation-942154182562b6c80bb9b536d24b1d8bd947452c.tar.gz
add tests for auto-slide events #766
-rw-r--r--test/test.js78
1 files changed, 64 insertions, 14 deletions
diff --git a/test/test.js b/test/test.js
index 23c0aff..e833bd4 100644
--- a/test/test.js
+++ b/test/test.js
@@ -57,20 +57,6 @@ Reveal.addEventListener( 'ready', function() {
strictEqual( Reveal.isPaused(), false, 'false after resuming' );
});
- test( 'Reveal.isAutoSliding', function() {
- strictEqual( Reveal.isAutoSliding(), false, 'false by default' );
-
- Reveal.configure({ autoSlide: 10000 });
- strictEqual( Reveal.isAutoSliding(), true, 'true after starting' );
-
- Reveal.toggleAutoSlide();
- strictEqual( Reveal.isAutoSliding(), false, 'false after toggling' );
- Reveal.toggleAutoSlide();
-
- Reveal.configure({ autoSlide: 0 });
- strictEqual( Reveal.isAutoSliding(), false, 'false after setting to 0' );
- });
-
test( 'Reveal.isFirstSlide', function() {
Reveal.slide( 0, 0 );
strictEqual( Reveal.isFirstSlide(), true, 'true after Reveal.slide( 0, 0 )' );
@@ -346,6 +332,70 @@ Reveal.addEventListener( 'ready', function() {
// ---------------------------------------------------------------
+ // AUTO-SLIDE TESTS
+
+ QUnit.module( 'Auto Sliding' );
+
+ test( 'Reveal.isAutoSliding', function() {
+ strictEqual( Reveal.isAutoSliding(), false, 'false by default' );
+
+ Reveal.configure({ autoSlide: 10000 });
+ strictEqual( Reveal.isAutoSliding(), true, 'true after starting' );
+
+ Reveal.configure({ autoSlide: 0 });
+ strictEqual( Reveal.isAutoSliding(), false, 'false after setting to 0' );
+ });
+
+ test( 'Reveal.toggleAutoSlide', function() {
+ Reveal.configure({ autoSlide: 10000 });
+
+ Reveal.toggleAutoSlide();
+ strictEqual( Reveal.isAutoSliding(), false, 'false after first toggle' );
+ Reveal.toggleAutoSlide();
+ strictEqual( Reveal.isAutoSliding(), true, 'true after second toggle' );
+
+ Reveal.configure({ autoSlide: 0 });
+ });
+
+ asyncTest( 'autoslidepaused', function() {
+ expect( 1 );
+
+ var _onEvent = function( event ) {
+ ok( true, 'event fired' );
+ }
+
+ Reveal.addEventListener( 'autoslidepaused', _onEvent );
+ Reveal.configure({ autoSlide: 10000 });
+ Reveal.toggleAutoSlide();
+
+ start();
+
+ // cleanup
+ Reveal.configure({ autoSlide: 0 });
+ Reveal.removeEventListener( 'autoslidepaused', _onEvent );
+ });
+
+ asyncTest( 'autoslideresumed', function() {
+ expect( 1 );
+
+ var _onEvent = function( event ) {
+ ok( true, 'event fired' );
+ }
+
+ Reveal.addEventListener( 'autoslideresumed', _onEvent );
+ Reveal.configure({ autoSlide: 10000 });
+ Reveal.toggleAutoSlide();
+ Reveal.toggleAutoSlide();
+
+ start();
+
+ // cleanup
+ Reveal.configure({ autoSlide: 0 });
+ Reveal.removeEventListener( 'autoslideresumed', _onEvent );
+ });
+
+
+ // ---------------------------------------------------------------
// CONFIGURATION VALUES
QUnit.module( 'Configuration' );