aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test-markdown-element-attributes.html8
-rw-r--r--test/test-markdown-slide-attributes.html10
-rw-r--r--test/test-markdown.html4
-rw-r--r--test/test.js78
4 files changed, 89 insertions, 11 deletions
diff --git a/test/test-markdown-element-attributes.html b/test/test-markdown-element-attributes.html
index b638082..27b888c 100644
--- a/test/test-markdown-element-attributes.html
+++ b/test/test-markdown-element-attributes.html
@@ -19,10 +19,10 @@
<div class="slides">
- <!-- <section data-markdown="example.md" data-separator="^\n\n\n" data-vertical="^\n\n"></section> -->
+ <!-- <section data-markdown="example.md" data-separator="^\n\n\n" data-separator-vertical="^\n\n"></section> -->
<!-- Slides are separated by newline + three dashes + newline, vertical slides identical but two dashes -->
- <section data-markdown data-separator="^\n---\n$" data-vertical="^\n--\n$" data-element-attributes="{_\s*?([^}]+?)}">>
+ <section data-markdown data-separator="^\n---\n$" data-separator-vertical="^\n--\n$" data-element-attributes="{_\s*?([^}]+?)}">>
<script type="text/template">
## Slide 1.1
<!-- {_class="fragment fade-out" data-fragment-index="1"} -->
@@ -75,8 +75,8 @@
<section data-markdown data-separator="^\n\n\n"
- data-vertical="^\n\n"
- data-notes="^Note:"
+ data-separator-vertical="^\n\n"
+ data-separator-notes="^Note:"
data-charset="utf-8">
<script type="text/template">
# Test attributes in Markdown with default separator
diff --git a/test/test-markdown-slide-attributes.html b/test/test-markdown-slide-attributes.html
index 3b91784..bd7b28f 100644
--- a/test/test-markdown-slide-attributes.html
+++ b/test/test-markdown-slide-attributes.html
@@ -19,12 +19,12 @@
<div class="slides">
- <!-- <section data-markdown="example.md" data-separator="^\n\n\n" data-vertical="^\n\n"></section> -->
+ <!-- <section data-markdown="example.md" data-separator="^\n\n\n" data-separator-vertical="^\n\n"></section> -->
<!-- Slides are separated by three lines, vertical slides by two lines, attributes are one any line starting with (spaces and) two dashes -->
<section data-markdown data-separator="^\n\n\n"
- data-vertical="^\n\n"
- data-notes="^Note:"
+ data-separator-vertical="^\n\n"
+ data-separator-notes="^Note:"
data-attributes="--\s(.*?)$"
data-charset="utf-8">
<script type="text/template">
@@ -56,8 +56,8 @@
</section>
<section data-markdown data-separator="^\n\n\n"
- data-vertical="^\n\n"
- data-notes="^Note:"
+ data-separator-vertical="^\n\n"
+ data-separator-notes="^Note:"
data-charset="utf-8">
<script type="text/template">
# Test attributes in Markdown with default separator
diff --git a/test/test-markdown.html b/test/test-markdown.html
index c89af30..901b2de 100644
--- a/test/test-markdown.html
+++ b/test/test-markdown.html
@@ -19,10 +19,10 @@
<div class="slides">
- <!-- <section data-markdown="example.md" data-separator="^\n\n\n" data-vertical="^\n\n"></section> -->
+ <!-- <section data-markdown="example.md" data-separator="^\n\n\n" data-separator-vertical="^\n\n"></section> -->
<!-- Slides are separated by newline + three dashes + newline, vertical slides identical but two dashes -->
- <section data-markdown data-separator="^\n---\n$" data-vertical="^\n--\n$">
+ <section data-markdown data-separator="^\n---\n$" data-separator-vertical="^\n--\n$">
<script type="text/template">
## Slide 1.1
diff --git a/test/test.js b/test/test.js
index f620b5b..90a002a 100644
--- a/test/test.js
+++ b/test/test.js
@@ -81,6 +81,10 @@ Reveal.addEventListener( 'ready', function() {
strictEqual( Reveal.isLastSlide(), false, 'false after Reveal.slide( 0, 0 )' );
});
+ test( 'Reveal.getTotalSlides', function() {
+ strictEqual( Reveal.getTotalSlides(), 8, 'eight slides in total' );
+ });
+
test( 'Reveal.getIndices', function() {
var indices = Reveal.getIndices();
@@ -116,6 +120,16 @@ Reveal.addEventListener( 'ready', function() {
equal( Reveal.getCurrentSlide(), secondSlide, 'current is slide #1' );
});
+ test( 'Reveal.getProgress', function() {
+ Reveal.slide( 0, 0 );
+ strictEqual( Reveal.getProgress(), 0, 'progress is 0 on first slide' );
+
+ var lastSlideIndex = document.querySelectorAll( '.reveal .slides>section' ).length - 1;
+
+ Reveal.slide( lastSlideIndex, 0 );
+ strictEqual( Reveal.getProgress(), 1, 'progress is 1 on last slide' );
+ });
+
test( 'Reveal.getScale', function() {
ok( typeof Reveal.getScale() === 'number', 'has scale' );
});
@@ -332,6 +346,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' );