aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2013-08-22 20:27:41 -0400
committerHakim El Hattab <hakim.elhattab@gmail.com>2013-08-22 20:27:41 -0400
commitb3db69745d05c8180258d3fa6efed9f790cd4317 (patch)
tree3e33dd3ae499794f32a1c72aa67b3a967801af24 /test
parent45fd91f962b01e52fba54e5d907031544fe78e21 (diff)
downloadfosdem-2018-presentation-b3db69745d05c8180258d3fa6efed9f790cd4317.tar
fosdem-2018-presentation-b3db69745d05c8180258d3fa6efed9f790cd4317.tar.gz
more tests #123
Diffstat (limited to 'test')
-rw-r--r--test/test.js66
1 files changed, 65 insertions, 1 deletions
diff --git a/test/test.js b/test/test.js
index f7c785f..ef66ea3 100644
--- a/test/test.js
+++ b/test/test.js
@@ -1,4 +1,12 @@
+// These tests expect the DOM to contain a presentation
+// with the following slide structure:
+//
+// 1
+// 2 - Three sub-slides
+// 3 - Three fragment elements
+// 4
+
Reveal.addEventListener( 'ready', function() {
@@ -114,13 +122,69 @@ Reveal.addEventListener( 'ready', function() {
deepEqual( Reveal.availableRoutes(), { left: false, up: false, down: false, right: true }, 'correct for first slide' );
});
+ test( 'Reveal.next', function() {
+ Reveal.slide( 0, 0 );
+
+ // Step through the vertical child slides
+ Reveal.next();
+ deepEqual( Reveal.getIndices(), { h: 1, v: 0, f: undefined } );
+
+ Reveal.next();
+ deepEqual( Reveal.getIndices(), { h: 1, v: 1, f: undefined } );
+
+ Reveal.next();
+ deepEqual( Reveal.getIndices(), { h: 1, v: 2, f: undefined } );
+
+ // There's fragments on this slide
+ Reveal.next();
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 0 } );
+
+ Reveal.next();
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 1 } );
+
+ Reveal.next();
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 2 } );
+
+ Reveal.next();
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 3 } );
+
+ Reveal.next();
+ deepEqual( Reveal.getIndices(), { h: 3, v: 0, f: undefined } );
+
+ // We're at the end
+ Reveal.next();
+ deepEqual( Reveal.getIndices(), { h: 3, v: 0, f: undefined } );
+ });
+
// ---------------------------------------------------------------
// TODO: FRAGMENT TESTS
// ---------------------------------------------------------------
- // TODO: CONFIGURATION VALUES
+ // CONFIGURATION VALUES
+
+ QUnit.module( 'Configuration' );
+
+ test( 'Controls', function() {
+ var controlsElement = document.querySelector( '.reveal>.controls' );
+
+ Reveal.configure({ controls: false });
+ equal( controlsElement.style.display, 'none', 'controls are hidden' );
+
+ Reveal.configure({ controls: true });
+ equal( controlsElement.style.display, 'block', 'controls are visible' );
+ });
+
+ test( 'Progress', function() {
+ var progressElement = document.querySelector( '.reveal>.progress' );
+
+ Reveal.configure({ progress: false });
+ equal( progressElement.style.display, 'none', 'progress are hidden' );
+
+ Reveal.configure({ progress: true });
+ equal( progressElement.style.display, 'block', 'progress are visible' );
+ });
// ---------------------------------------------------------------