summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/examples/barebones.html4
-rw-r--r--test/examples/embedded-media.html4
-rw-r--r--test/examples/math.html4
-rw-r--r--test/examples/slide-backgrounds.html36
-rw-r--r--test/test-markdown-attributes.html128
-rw-r--r--test/test-markdown-attributes.js47
-rw-r--r--test/test-markdown-element-attributes.html98
-rw-r--r--test/test-markdown-element-attributes.js22
-rw-r--r--test/test-markdown-slide-attributes.html128
-rw-r--r--test/test-markdown-slide-attributes.js47
-rw-r--r--test/test-markdown.html8
-rw-r--r--test/test-pdf.html83
-rw-r--r--test/test-pdf.js15
-rw-r--r--test/test.html9
-rw-r--r--test/test.js152
15 files changed, 550 insertions, 235 deletions
diff --git a/test/examples/barebones.html b/test/examples/barebones.html
index c948d00..2bee3cb 100644
--- a/test/examples/barebones.html
+++ b/test/examples/barebones.html
@@ -6,7 +6,7 @@
<title>reveal.js - Barebones</title>
- <link rel="stylesheet" href="../../css/reveal.min.css">
+ <link rel="stylesheet" href="../../css/reveal.css">
</head>
<body>
@@ -29,7 +29,7 @@
</div>
- <script src="../../js/reveal.min.js"></script>
+ <script src="../../js/reveal.js"></script>
<script>
diff --git a/test/examples/embedded-media.html b/test/examples/embedded-media.html
index c654278..bbad4be 100644
--- a/test/examples/embedded-media.html
+++ b/test/examples/embedded-media.html
@@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
- <link rel="stylesheet" href="../../css/reveal.min.css">
+ <link rel="stylesheet" href="../../css/reveal.css">
<link rel="stylesheet" href="../../css/theme/default.css" id="theme">
</head>
@@ -35,7 +35,7 @@
</div>
<script src="../../lib/js/head.min.js"></script>
- <script src="../../js/reveal.min.js"></script>
+ <script src="../../js/reveal.js"></script>
<script>
diff --git a/test/examples/math.html b/test/examples/math.html
index 93eff22..1b80e03 100644
--- a/test/examples/math.html
+++ b/test/examples/math.html
@@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
- <link rel="stylesheet" href="../../css/reveal.min.css">
+ <link rel="stylesheet" href="../../css/reveal.css">
<link rel="stylesheet" href="../../css/theme/night.css" id="theme">
</head>
@@ -160,7 +160,7 @@
</div>
<script src="../../lib/js/head.min.js"></script>
- <script src="../../js/reveal.min.js"></script>
+ <script src="../../js/reveal.js"></script>
<script>
diff --git a/test/examples/slide-backgrounds.html b/test/examples/slide-backgrounds.html
index 4f0fe62..4e5e406 100644
--- a/test/examples/slide-backgrounds.html
+++ b/test/examples/slide-backgrounds.html
@@ -8,8 +8,18 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
- <link rel="stylesheet" href="../../css/reveal.min.css">
+ <link rel="stylesheet" href="../../css/reveal.css">
<link rel="stylesheet" href="../../css/theme/serif.css" id="theme">
+ <style type="text/css" media="screen">
+ .slides section.has-dark-background,
+ .slides section.has-dark-background h2 {
+ color: #fff;
+ }
+ .slides section.has-light-background,
+ .slides section.has-light-background h2 {
+ color: #222;
+ }
+ </style>
</head>
<body>
@@ -26,6 +36,10 @@
<h2>data-background: #bb00bb</h2>
</section>
+ <section data-background-color="lightblue">
+ <h2>data-background: lightblue</h2>
+ </section>
+
<section>
<section data-background="#ff0000">
<h2>data-background: #ff0000</h2>
@@ -45,25 +59,25 @@
<section>
<h2>Background applied to stack</h2>
</section>
- <section data-background="rgba(100, 0, 0, 0.2)">
+ <section data-background="rgb(66, 66, 66)">
<h2>Background applied to slide inside of stack</h2>
</section>
</section>
- <section data-background-transition="slide" data-background="assets/image1.png" style="background: rgba(255,255,255,0.9)">
+ <section data-background-transition="slide" data-background="assets/image1.png">
<h2>Background image</h2>
</section>
<section>
- <section data-background-transition="slide" data-background="assets/image1.png" style="background: rgba(255,255,255,0.9)">
+ <section data-background-transition="slide" data-background="assets/image1.png">
<h2>Background image</h2>
</section>
- <section data-background-transition="slide" data-background="assets/image1.png" style="background: rgba(255,255,255,0.9)">
+ <section data-background-transition="slide" data-background="assets/image1.png">
<h2>Background image</h2>
</section>
</section>
- <section data-background="assets/image2.png" data-background-size="100px" data-background-repeat="repeat" data-background-color="#111" style="background: rgba(255,255,255,0.9)">
+ <section data-background="assets/image2.png" data-background-size="100px" data-background-repeat="repeat" data-background-color="#111">
<h2>Background image</h2>
<pre>data-background-size="100px" data-background-repeat="repeat" data-background-color="#111"</pre>
</section>
@@ -75,6 +89,14 @@
<h2>Same background twice (2/2)</h2>
</section>
+ <section data-background-video="https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.mp4,https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.webm">
+ <h2>Video background</h2>
+ </section>
+
+ <section data-background-iframe="https://slides.com">
+ <h2>Iframe background</h2>
+ </section>
+
<section>
<section data-background="#417203">
<h2>Same background twice vertical (1/2)</h2>
@@ -101,7 +123,7 @@
</div>
<script src="../../lib/js/head.min.js"></script>
- <script src="../../js/reveal.min.js"></script>
+ <script src="../../js/reveal.js"></script>
<script>
diff --git a/test/test-markdown-attributes.html b/test/test-markdown-attributes.html
deleted file mode 100644
index cc03177..0000000
--- a/test/test-markdown-attributes.html
+++ /dev/null
@@ -1,128 +0,0 @@
-<!doctype html>
-<html lang="en">
-
- <head>
- <meta charset="utf-8">
-
- <title>reveal.js - Test Markdown Attributes</title>
-
- <link rel="stylesheet" href="../css/reveal.min.css">
- <link rel="stylesheet" href="qunit-1.12.0.css">
- </head>
-
- <body style="overflow: auto;">
-
- <div id="qunit"></div>
- <div id="qunit-fixture"></div>
-
- <div class="reveal" style="display: none;">
-
- <div class="slides">
-
- <!-- <section data-markdown="example.md" data-separator="^\n\n\n" data-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-attributes="^\s*?--\s(.*?)$"
- data-charset="utf-8">
- <script type="text/template">
- # Test attributes in Markdown
- ## Slide 1
-
-
-
- ## Slide 2
- -- id="slide2" data-transition="zoom" data-background="#A0C66B"
-
-
- ## Slide 2.1
- -- data-background="#ff0000" data-transition="fade"
-
-
- ## Slide 2.2
- [Link to Slide2](#/slide2)
-
-
-
- ## Slide 3
- -- data-transition="zoom" data-background="#C6916B"
-
-
-
- ## Slide 4
- </script>
- </section>
-
- <section data-markdown data-separator="^\n\n\n"
- data-vertical="^\n\n"
- data-notes="^Note:"
- data-charset="utf-8">
- <script type="text/template">
- # Test attributes in Markdown with default separator
- ## Slide 1 Def
-
-
-
- ## Slide 2 Def
- <!-- slide-attributes: id="slide2def" data-transition="concave" data-background="#A7C66B" -->
-
-
- ## Slide 2.1 Def
- <!-- slide-attributes: data-background="#f70000" data-transition="page" -->
-
-
- ## Slide 2.2 Def
- [Link to Slide2](#/slide2def)
-
-
-
- ## Slide 3 Def
- <!-- slide-attributes: data-transition="concave" data-background="#C7916B" -->
-
-
-
- ## Slide 4
- </script>
- </section>
-
- <section data-markdown>
- <script type="text/template">
- <!-- slide-attributes: data-background="#ff0000" -->
- ## Hello world
- </script>
- </section>
-
- <section data-markdown>
- <script type="text/template">
- ## Hello world
- <!-- slide-attributes: data-background="#ff0000" -->
- </script>
- </section>
-
- <section data-markdown>
- <script type="text/template">
- ## Hello world
-
- Test
- <!-- slide-attributes: data-background="#ff0000" -->
-
- More Test
- </script>
- </section>
-
- </div>
-
- </div>
-
- <script src="../lib/js/head.min.js"></script>
- <script src="../js/reveal.min.js"></script>
- <script src="../plugin/markdown/marked.js"></script>
- <script src="../plugin/markdown/markdown.js"></script>
- <script src="qunit-1.12.0.js"></script>
-
- <script src="test-markdown-attributes.js"></script>
-
- </body>
-</html>
diff --git a/test/test-markdown-attributes.js b/test/test-markdown-attributes.js
deleted file mode 100644
index a11f63b..0000000
--- a/test/test-markdown-attributes.js
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-Reveal.addEventListener( 'ready', function() {
-
- QUnit.module( 'Markdown' );
-
- test( 'Vertical separator', function() {
- strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 6, 'found six vertical slides' );
- });
-
- test( 'Id on slide', function() {
- strictEqual( document.querySelectorAll( '.reveal .slides>section>section#slide2' ).length, 1, 'found one slide with id slide2' );
- strictEqual( document.querySelectorAll( '.reveal .slides>section>section a[href="#/slide2"]' ).length, 1, 'found one slide with a link to slide2' );
- });
-
- test( 'data-background attributes', function() {
- strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#A0C66B"]' ).length, 1, 'found one vertical slide with data-background="#A0C66B"' );
- strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#ff0000"]' ).length, 1, 'found one vertical slide with data-background="#ff0000"' );
- strictEqual( document.querySelectorAll( '.reveal .slides>section[data-background="#C6916B"]' ).length, 1, 'found one slide with data-background="#C6916B"' );
- });
-
- test( 'data-transition attributes', function() {
- strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="zoom"]' ).length, 1, 'found one vertical slide with data-transition="zoom"' );
- strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="fade"]' ).length, 1, 'found one vertical slide with data-transition="fade"' );
- strictEqual( document.querySelectorAll( '.reveal .slides section [data-transition="zoom"]' ).length, 1, 'found one slide with data-transition="zoom"' );
- });
-
- test( 'data-background attributes with default separator', function() {
- strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#A7C66B"]' ).length, 1, 'found one vertical slide with data-background="#A0C66B"' );
- strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#f70000"]' ).length, 1, 'found one vertical slide with data-background="#ff0000"' );
- strictEqual( document.querySelectorAll( '.reveal .slides>section[data-background="#C7916B"]' ).length, 1, 'found one slide with data-background="#C6916B"' );
- });
-
- test( 'data-transition attributes with default separator', function() {
- strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="concave"]' ).length, 1, 'found one vertical slide with data-transition="zoom"' );
- strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="page"]' ).length, 1, 'found one vertical slide with data-transition="fade"' );
- strictEqual( document.querySelectorAll( '.reveal .slides section [data-transition="concave"]' ).length, 1, 'found one slide with data-transition="zoom"' );
- });
-
- test( 'data-transition attributes with inline content', function() {
- strictEqual( document.querySelectorAll( '.reveal .slides>section[data-background="#ff0000"]' ).length, 3, 'found three horizontal slides with data-background="#ff0000"' );
- });
-
-} );
-
-Reveal.initialize();
-
diff --git a/test/test-markdown-element-attributes.html b/test/test-markdown-element-attributes.html
index 417ce30..5dba085 100644
--- a/test/test-markdown-element-attributes.html
+++ b/test/test-markdown-element-attributes.html
@@ -4,39 +4,43 @@
<head>
<meta charset="utf-8">
- <title>reveal.js - Test Markdown</title>
+ <title>reveal.js - Test Markdown Element Attributes</title>
- <link rel="stylesheet" href="../css/reveal.min.css">
+ <link rel="stylesheet" href="../css/reveal.css">
<link rel="stylesheet" href="qunit-1.12.0.css">
</head>
<body style="overflow: auto;">
<div id="qunit"></div>
- <div id="qunit-fixture"></div>
+ <div id="qunit-fixture"></div>
<div class="reveal" style="display: none;">
<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"}
+ ## Slide 1.1
+ <!-- {_class="fragment fade-out" data-fragment-index="1"} -->
--
- ## Slide 1.2 {_class="fragment shrink"}
+ ## Slide 1.2
+ <!-- {_class="fragment shrink"} -->
- Paragraph 1 {_class="fragment grow"}
+ Paragraph 1
+ <!-- {_class="fragment grow"} -->
- Paragraph 2 {_class="fragment grow"}
+ Paragraph 2
+ <!-- {_class="fragment grow"} -->
- - list item 1 {_class="fragment roll-in"}
- - list item 2 {_class="fragment roll-in"}
- - list item 3 {_class="fragment roll-in"}
+ - list item 1 <!-- {_class="fragment roll-in"} -->
+ - list item 2 <!-- {_class="fragment roll-in"} -->
+ - list item 3 <!-- {_class="fragment roll-in"} -->
---
@@ -45,33 +49,81 @@
Paragraph 1.2
- multi-line {_class="fragment highlight-red"}
+ multi-line <!-- {_class="fragment highlight-red"} -->
- Paragraph 2.2 {_class="fragment highlight-red"}
+ Paragraph 2.2 <!-- {_class="fragment highlight-red"} -->
- Paragraph 2.3 {_class="fragment highlight-red"}
+ Paragraph 2.3 <!-- {_class="fragment highlight-red"} -->
- Paragraph 2.4 {_class="fragment highlight-red"}
+ Paragraph 2.4 <!-- {_class="fragment highlight-red"} -->
- - list item 1 {_class="fragment highlight-green"}
- - list item 2 {_class="fragment highlight-green"}
- - list item 3 {_class="fragment highlight-green"}
- - list item 4 {_class="fragment highlight-green"}
- - list item 5 {_class="fragment highlight-green"}
+ - list item 1 <!-- {_class="fragment highlight-green"} -->
+ - list item 2<!-- {_class="fragment highlight-green"} -->
+ - list item 3<!-- {_class="fragment highlight-green"} -->
+ - list item 4
+ <!-- {_class="fragment highlight-green"} -->
+ - list item 5<!-- {_class="fragment highlight-green"} -->
Test
- ![Example Picture{_class="reveal stretch"}](assets/image2.png)
+ ![Example Picture](examples/assets/image2.png)
+ <!-- {_class="reveal stretch"} -->
</script>
</section>
+
+
+ <section data-markdown data-separator="^\n\n\n"
+ data-separator-vertical="^\n\n"
+ data-separator-notes="^Note:"
+ data-charset="utf-8">
+ <script type="text/template">
+ # Test attributes in Markdown with default separator
+ ## Slide 1 Def <!-- .element: class="fragment highlight-red" data-fragment-index="1" -->
+
+
+ ## Slide 2 Def
+ <!-- .element: class="fragment highlight-red" -->
+
+ </script>
+ </section>
+
+ <section data-markdown>
+ <script type="text/template">
+ ## Hello world
+ A paragraph
+ <!-- .element: class="fragment highlight-blue" -->
+ </script>
+ </section>
+
+ <section data-markdown>
+ <script type="text/template">
+ ## Hello world
+
+ Multiple
+ Line
+ <!-- .element: class="fragment highlight-blue" -->
+ </script>
+ </section>
+
+ <section data-markdown>
+ <script type="text/template">
+ ## Hello world
+
+ Test<!-- .element: class="fragment highlight-blue" -->
+
+ More Test
+ </script>
+ </section>
+
+
</div>
</div>
<script src="../lib/js/head.min.js"></script>
- <script src="../js/reveal.min.js"></script>
+ <script src="../js/reveal.js"></script>
<script src="../plugin/markdown/marked.js"></script>
<script src="../plugin/markdown/markdown.js"></script>
<script src="qunit-1.12.0.js"></script>
diff --git a/test/test-markdown-element-attributes.js b/test/test-markdown-element-attributes.js
index e79806c..4541077 100644
--- a/test/test-markdown-element-attributes.js
+++ b/test/test-markdown-element-attributes.js
@@ -5,33 +5,41 @@ Reveal.addEventListener( 'ready', function() {
QUnit.module( 'Markdown' );
test( 'Vertical separator', function() {
- strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 2, 'found two slides' );
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 4, 'found four slides' );
});
- test( 'Attributes on vertical slides header', function() {
+ test( 'Attributes on element header in vertical slides', function() {
strictEqual( document.querySelectorAll( '.reveal .slides section>section h2.fragment.fade-out' ).length, 1, 'found one vertical slide with class fragment.fade-out on header' );
strictEqual( document.querySelectorAll( '.reveal .slides section>section h2.fragment.shrink' ).length, 1, 'found one vertical slide with class fragment.shrink on header' );
});
- test( 'Attributes on vertical slides paragraphs', function() {
+ test( 'Attributes on element paragraphs in vertical slides', function() {
strictEqual( document.querySelectorAll( '.reveal .slides section>section p.fragment.grow' ).length, 2, 'found a vertical slide with two paragraphs with class fragment.grow' );
});
- test( 'Attributes on vertical slides list items', function() {
+ test( 'Attributes on element list items in vertical slides', function() {
strictEqual( document.querySelectorAll( '.reveal .slides section>section li.fragment.roll-in' ).length, 3, 'found a vertical slide with three list items with class fragment.roll-in' );
});
- test( 'Attributes on horizontal slides paragraphs', function() {
+ test( 'Attributes on element paragraphs in horizontal slides', function() {
strictEqual( document.querySelectorAll( '.reveal .slides section p.fragment.highlight-red' ).length, 4, 'found a horizontal slide with four paragraphs with class fragment.grow' );
});
- test( 'Attributes on horizontal slides list items', function() {
+ test( 'Attributes on element list items in horizontal slides', function() {
strictEqual( document.querySelectorAll( '.reveal .slides section li.fragment.highlight-green' ).length, 5, 'found a horizontal slide with five list items with class fragment.roll-in' );
});
- test( 'Attributes on horizontal slides list items', function() {
+ test( 'Attributes on element list items in horizontal slides', function() {
strictEqual( document.querySelectorAll( '.reveal .slides section img.reveal.stretch' ).length, 1, 'found a horizontal slide with stretched image, class img.reveal.stretch' );
});
+ test( 'Attributes on elements in vertical slides with default element attribute separator', function() {
+ strictEqual( document.querySelectorAll( '.reveal .slides section h2.fragment.highlight-red' ).length, 2, 'found two h2 titles with fragment highlight-red in vertical slides with default element attribute separator' );
+ });
+
+ test( 'Attributes on elements in single slides with default element attribute separator', function() {
+ strictEqual( document.querySelectorAll( '.reveal .slides section p.fragment.highlight-blue' ).length, 3, 'found three elements with fragment highlight-blue in single slide with default element attribute separator' );
+ });
+
} );
Reveal.initialize();
diff --git a/test/test-markdown-slide-attributes.html b/test/test-markdown-slide-attributes.html
new file mode 100644
index 0000000..ab6ece4
--- /dev/null
+++ b/test/test-markdown-slide-attributes.html
@@ -0,0 +1,128 @@
+<!doctype html>
+<html lang="en">
+
+ <head>
+ <meta charset="utf-8">
+
+ <title>reveal.js - Test Markdown Attributes</title>
+
+ <link rel="stylesheet" href="../css/reveal.css">
+ <link rel="stylesheet" href="qunit-1.12.0.css">
+ </head>
+
+ <body style="overflow: auto;">
+
+ <div id="qunit"></div>
+ <div id="qunit-fixture"></div>
+
+ <div class="reveal" style="display: none;">
+
+ <div class="slides">
+
+ <!-- <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-separator-vertical="^\n\n"
+ data-separator-notes="^Note:"
+ data-attributes="--\s(.*?)$"
+ data-charset="utf-8">
+ <script type="text/template">
+ # Test attributes in Markdown
+ ## Slide 1
+
+
+
+ ## Slide 2
+ <!-- -- id="slide2" data-transition="zoom" data-background="#A0C66B" -->
+
+
+ ## Slide 2.1
+ <!-- -- data-background="#ff0000" data-transition="fade" -->
+
+
+ ## Slide 2.2
+ [Link to Slide2](#/slide2)
+
+
+
+ ## Slide 3
+ <!-- -- data-transition="zoom" data-background="#C6916B" -->
+
+
+
+ ## Slide 4
+ </script>
+ </section>
+
+ <section data-markdown data-separator="^\n\n\n"
+ data-separator-vertical="^\n\n"
+ data-separator-notes="^Note:"
+ data-charset="utf-8">
+ <script type="text/template">
+ # Test attributes in Markdown with default separator
+ ## Slide 1 Def
+
+
+
+ ## Slide 2 Def
+ <!-- .slide: id="slide2def" data-transition="concave" data-background="#A7C66B" -->
+
+
+ ## Slide 2.1 Def
+ <!-- .slide: data-background="#f70000" data-transition="page" -->
+
+
+ ## Slide 2.2 Def
+ [Link to Slide2](#/slide2def)
+
+
+
+ ## Slide 3 Def
+ <!-- .slide: data-transition="concave" data-background="#C7916B" -->
+
+
+
+ ## Slide 4
+ </script>
+ </section>
+
+ <section data-markdown>
+ <script type="text/template">
+ <!-- .slide: data-background="#ff0000" -->
+ ## Hello world
+ </script>
+ </section>
+
+ <section data-markdown>
+ <script type="text/template">
+ ## Hello world
+ <!-- .slide: data-background="#ff0000" -->
+ </script>
+ </section>
+
+ <section data-markdown>
+ <script type="text/template">
+ ## Hello world
+
+ Test
+ <!-- .slide: data-background="#ff0000" -->
+
+ More Test
+ </script>
+ </section>
+
+ </div>
+
+ </div>
+
+ <script src="../lib/js/head.min.js"></script>
+ <script src="../js/reveal.js"></script>
+ <script src="../plugin/markdown/marked.js"></script>
+ <script src="../plugin/markdown/markdown.js"></script>
+ <script src="qunit-1.12.0.js"></script>
+
+ <script src="test-markdown-slide-attributes.js"></script>
+
+ </body>
+</html>
diff --git a/test/test-markdown-slide-attributes.js b/test/test-markdown-slide-attributes.js
new file mode 100644
index 0000000..3817fd3
--- /dev/null
+++ b/test/test-markdown-slide-attributes.js
@@ -0,0 +1,47 @@
+
+
+Reveal.addEventListener( 'ready', function() {
+
+ QUnit.module( 'Markdown' );
+
+ test( 'Vertical separator', function() {
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 6, 'found six vertical slides' );
+ });
+
+ test( 'Id on slide', function() {
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section#slide2' ).length, 1, 'found one slide with id slide2' );
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section a[href="#/slide2"]' ).length, 1, 'found one slide with a link to slide2' );
+ });
+
+ test( 'data-background attributes', function() {
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#A0C66B"]' ).length, 1, 'found one vertical slide with data-background="#A0C66B"' );
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#ff0000"]' ).length, 1, 'found one vertical slide with data-background="#ff0000"' );
+ strictEqual( document.querySelectorAll( '.reveal .slides>section[data-background="#C6916B"]' ).length, 1, 'found one slide with data-background="#C6916B"' );
+ });
+
+ test( 'data-transition attributes', function() {
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="zoom"]' ).length, 1, 'found one vertical slide with data-transition="zoom"' );
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="fade"]' ).length, 1, 'found one vertical slide with data-transition="fade"' );
+ strictEqual( document.querySelectorAll( '.reveal .slides section [data-transition="zoom"]' ).length, 1, 'found one slide with data-transition="zoom"' );
+ });
+
+ test( 'data-background attributes with default separator', function() {
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#A7C66B"]' ).length, 1, 'found one vertical slide with data-background="#A0C66B"' );
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#f70000"]' ).length, 1, 'found one vertical slide with data-background="#ff0000"' );
+ strictEqual( document.querySelectorAll( '.reveal .slides>section[data-background="#C7916B"]' ).length, 1, 'found one slide with data-background="#C6916B"' );
+ });
+
+ test( 'data-transition attributes with default separator', function() {
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="concave"]' ).length, 1, 'found one vertical slide with data-transition="zoom"' );
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="page"]' ).length, 1, 'found one vertical slide with data-transition="fade"' );
+ strictEqual( document.querySelectorAll( '.reveal .slides section [data-transition="concave"]' ).length, 1, 'found one slide with data-transition="zoom"' );
+ });
+
+ test( 'data-transition attributes with inline content', function() {
+ strictEqual( document.querySelectorAll( '.reveal .slides>section[data-background="#ff0000"]' ).length, 3, 'found three horizontal slides with data-background="#ff0000"' );
+ });
+
+} );
+
+Reveal.initialize();
+
diff --git a/test/test-markdown.html b/test/test-markdown.html
index c89af30..7ff0efe 100644
--- a/test/test-markdown.html
+++ b/test/test-markdown.html
@@ -6,7 +6,7 @@
<title>reveal.js - Test Markdown</title>
- <link rel="stylesheet" href="../css/reveal.min.css">
+ <link rel="stylesheet" href="../css/reveal.css">
<link rel="stylesheet" href="qunit-1.12.0.css">
</head>
@@ -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
@@ -41,7 +41,7 @@
</div>
<script src="../lib/js/head.min.js"></script>
- <script src="../js/reveal.min.js"></script>
+ <script src="../js/reveal.js"></script>
<script src="../plugin/markdown/marked.js"></script>
<script src="../plugin/markdown/markdown.js"></script>
<script src="qunit-1.12.0.js"></script>
diff --git a/test/test-pdf.html b/test/test-pdf.html
new file mode 100644
index 0000000..751ed26
--- /dev/null
+++ b/test/test-pdf.html
@@ -0,0 +1,83 @@
+<!doctype html>
+<html lang="en">
+
+ <head>
+ <meta charset="utf-8">
+
+ <title>reveal.js - Test PDF exports</title>
+
+ <link rel="stylesheet" href="../css/reveal.css">
+ <link rel="stylesheet" href="../css/print/pdf.css">
+ <link rel="stylesheet" href="qunit-1.12.0.css">
+ </head>
+
+ <body style="overflow: auto;">
+
+ <div id="qunit"></div>
+ <div id="qunit-fixture"></div>
+
+ <div class="reveal" style="display: none;">
+
+ <div class="slides">
+
+ <section>
+ <h1>1</h1>
+ <img data-src="fake-url.png">
+ </section>
+
+ <section>
+ <section>
+ <h1>2.1</h1>
+ </section>
+ <section>
+ <h1>2.2</h1>
+ </section>
+ <section>
+ <h1>2.3</h1>
+ </section>
+ </section>
+
+ <section id="fragment-slides">
+ <section>
+ <h1>3.1</h1>
+ <ul>
+ <li class="fragment">4.1</li>
+ <li class="fragment">4.2</li>
+ <li class="fragment">4.3</li>
+ </ul>
+ </section>
+
+ <section>
+ <h1>3.2</h1>
+ <ul>
+ <li class="fragment" data-fragment-index="0">4.1</li>
+ <li class="fragment" data-fragment-index="0">4.2</li>
+ </ul>
+ </section>
+
+ <section>
+ <h1>3.3</h1>
+ <ul>
+ <li class="fragment" data-fragment-index="1">3.3.1</li>
+ <li class="fragment" data-fragment-index="4">3.3.2</li>
+ <li class="fragment" data-fragment-index="4">3.3.3</li>
+ </ul>
+ </section>
+ </section>
+
+ <section>
+ <h1>4</h1>
+ </section>
+
+ </div>
+
+ </div>
+
+ <script src="../lib/js/head.min.js"></script>
+ <script src="../js/reveal.js"></script>
+ <script src="qunit-1.12.0.js"></script>
+
+ <script src="test-pdf.js"></script>
+
+ </body>
+</html>
diff --git a/test/test-pdf.js b/test/test-pdf.js
new file mode 100644
index 0000000..8ec34fd
--- /dev/null
+++ b/test/test-pdf.js
@@ -0,0 +1,15 @@
+
+Reveal.addEventListener( 'ready', function() {
+
+ // Only one test for now, we're mainly ensuring that there
+ // are no execution errors when running PDF mode
+
+ test( 'Reveal.isReady', function() {
+ strictEqual( Reveal.isReady(), true, 'returns true' );
+ });
+
+
+} );
+
+Reveal.initialize({ pdf: true });
+
diff --git a/test/test.html b/test/test.html
index 094f3c7..29d02a9 100644
--- a/test/test.html
+++ b/test/test.html
@@ -6,7 +6,7 @@
<title>reveal.js - Tests</title>
- <link rel="stylesheet" href="../css/reveal.min.css">
+ <link rel="stylesheet" href="../css/reveal.css">
<link rel="stylesheet" href="qunit-1.12.0.css">
</head>
@@ -19,12 +19,13 @@
<div class="slides">
- <section>
+ <section data-background-image="examples/assets/image1.png">
<h1>1</h1>
+ <img data-src="fake-url.png">
</section>
<section>
- <section>
+ <section data-background="examples/assets/image2.png">
<h1>2.1</h1>
</section>
<section>
@@ -72,7 +73,7 @@
</div>
<script src="../lib/js/head.min.js"></script>
- <script src="../js/reveal.min.js"></script>
+ <script src="../js/reveal.js"></script>
<script src="qunit-1.12.0.js"></script>
<script src="test.js"></script>
diff --git a/test/test.js b/test/test.js
index f620b5b..3f93d3c 100644
--- a/test/test.js
+++ b/test/test.js
@@ -68,6 +68,12 @@ Reveal.addEventListener( 'ready', function() {
strictEqual( Reveal.isFirstSlide(), true, 'true after Reveal.slide( 0, 0 )' );
});
+ test( 'Reveal.isFirstSlide after vertical slide', function() {
+ Reveal.slide( 1, 1 );
+ Reveal.slide( 0, 0 );
+ strictEqual( Reveal.isFirstSlide(), true, 'true after Reveal.slide( 1, 1 ) and then Reveal.slide( 0, 0 )' );
+ });
+
test( 'Reveal.isLastSlide', function() {
Reveal.slide( 0, 0 );
strictEqual( Reveal.isLastSlide(), false, 'false after Reveal.slide( 0, 0 )' );
@@ -75,34 +81,62 @@ Reveal.addEventListener( 'ready', function() {
var lastSlideIndex = document.querySelectorAll( '.reveal .slides>section' ).length - 1;
Reveal.slide( lastSlideIndex, 0 );
- strictEqual( Reveal.isLastSlide(), true, 'true after Reveal.slide( ', 0+ lastSlideIndex +' )' );
+ strictEqual( Reveal.isLastSlide(), true, 'true after Reveal.slide( '+ lastSlideIndex +', 0 )' );
Reveal.slide( 0, 0 );
strictEqual( Reveal.isLastSlide(), false, 'false after Reveal.slide( 0, 0 )' );
});
+ test( 'Reveal.isLastSlide after vertical slide', function() {
+ var lastSlideIndex = document.querySelectorAll( '.reveal .slides>section' ).length - 1;
+
+ Reveal.slide( 1, 1 );
+ Reveal.slide( lastSlideIndex );
+ strictEqual( Reveal.isLastSlide(), true, 'true after Reveal.slide( 1, 1 ) and then Reveal.slide( '+ lastSlideIndex +', 0 )' );
+ });
+
+ test( 'Reveal.getTotalSlides', function() {
+ strictEqual( Reveal.getTotalSlides(), 8, 'eight slides in total' );
+ });
+
test( 'Reveal.getIndices', function() {
var indices = Reveal.getIndices();
- ok( typeof indices.hasOwnProperty( 'h' ), 'h exists' );
- ok( typeof indices.hasOwnProperty( 'v' ), 'v exists' );
- ok( typeof indices.hasOwnProperty( 'f' ), 'f exists' );
+ ok( indices.hasOwnProperty( 'h' ), 'h exists' );
+ ok( indices.hasOwnProperty( 'v' ), 'v exists' );
+ ok( indices.hasOwnProperty( 'f' ), 'f exists' );
Reveal.slide( 1, 0 );
- ok( Reveal.getIndices().h === 1 && Reveal.getIndices().v === 0, 'h 1, v 0' );
+ strictEqual( Reveal.getIndices().h, 1, 'h 1' );
+ strictEqual( Reveal.getIndices().v, 0, 'v 0' );
Reveal.slide( 1, 2 );
- ok( Reveal.getIndices().h === 1 && Reveal.getIndices().v === 2, 'h 1, v 2' );
+ strictEqual( Reveal.getIndices().h, 1, 'h 1' );
+ strictEqual( Reveal.getIndices().v, 2, 'v 2' );
Reveal.slide( 0, 0 );
+ strictEqual( Reveal.getIndices().h, 0, 'h 0' );
+ strictEqual( Reveal.getIndices().v, 0, 'v 0' );
});
test( 'Reveal.getSlide', function() {
- var firstSlide = document.querySelector( '.reveal .slides>section:first-child' );
+ equal( Reveal.getSlide( 0 ), document.querySelector( '.reveal .slides>section:first-child' ), 'gets correct first slide' );
+ equal( Reveal.getSlide( 1 ), document.querySelector( '.reveal .slides>section:nth-child(2)' ), 'no v index returns stack' );
+ equal( Reveal.getSlide( 1, 0 ), document.querySelector( '.reveal .slides>section:nth-child(2)>section:nth-child(1)' ), 'v index 0 returns first vertical child' );
+ equal( Reveal.getSlide( 1, 1 ), document.querySelector( '.reveal .slides>section:nth-child(2)>section:nth-child(2)' ), 'v index 1 returns second vertical child' );
+
+ strictEqual( Reveal.getSlide( 100 ), undefined, 'undefined when out of horizontal bounds' );
+ strictEqual( Reveal.getSlide( 1, 100 ), undefined, 'undefined when out of vertical bounds' );
+ });
- equal( Reveal.getSlide( 0 ), firstSlide, 'gets correct first slide' );
+ test( 'Reveal.getSlideBackground', function() {
+ equal( Reveal.getSlideBackground( 0 ), document.querySelector( '.reveal .backgrounds>.slide-background:first-child' ), 'gets correct first background' );
+ equal( Reveal.getSlideBackground( 1 ), document.querySelector( '.reveal .backgrounds>.slide-background:nth-child(2)' ), 'no v index returns stack' );
+ equal( Reveal.getSlideBackground( 1, 0 ), document.querySelector( '.reveal .backgrounds>.slide-background:nth-child(2) .slide-background:nth-child(1)' ), 'v index 0 returns first vertical child' );
+ equal( Reveal.getSlideBackground( 1, 1 ), document.querySelector( '.reveal .backgrounds>.slide-background:nth-child(2) .slide-background:nth-child(2)' ), 'v index 1 returns second vertical child' );
- strictEqual( Reveal.getSlide( 100 ), undefined, 'returns undefined when slide can\'t be found' );
+ strictEqual( Reveal.getSlideBackground( 100 ), undefined, 'undefined when out of horizontal bounds' );
+ strictEqual( Reveal.getSlideBackground( 1, 100 ), undefined, 'undefined when out of vertical bounds' );
});
test( 'Reveal.getPreviousSlide/getCurrentSlide', function() {
@@ -116,6 +150,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' );
});
@@ -269,6 +313,13 @@ Reveal.addEventListener( 'ready', function() {
Reveal.slide( 3, 0, 0 );
equal( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 2, 'both fragments of same index are shown' );
+
+ // This slide has three fragments, first one is index 0, second and third have index 1
+ Reveal.slide( 2, 2, 0 );
+ equal( Reveal.getIndices().f, 0, 'returns correct index for first fragment' );
+
+ Reveal.slide( 2, 2, 1 );
+ equal( Reveal.getIndices().f, 1, 'returns correct index for two fragments with same index' );
});
test( 'Index generation', function() {
@@ -332,6 +383,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' );
@@ -372,6 +487,25 @@ Reveal.addEventListener( 'ready', function() {
// ---------------------------------------------------------------
+ // LAZY-LOADING TESTS
+
+ QUnit.module( 'Lazy-Loading' );
+
+ test( 'img with data-src', function() {
+ strictEqual( document.querySelectorAll( '.reveal section img[src]' ).length, 1, 'Image source has been set' );
+ });
+
+ test( 'background images', function() {
+ var imageSource1 = Reveal.getSlide( 0 ).getAttribute( 'data-background-image' );
+ var imageSource2 = Reveal.getSlide( 1, 0 ).getAttribute( 'data-background' );
+
+ // check that the images are applied to the background elements
+ ok( Reveal.getSlideBackground( 0 ).style.backgroundImage.indexOf( imageSource1 ) !== -1, 'data-background-image worked' );
+ ok( Reveal.getSlideBackground( 1, 0 ).style.backgroundImage.indexOf( imageSource2 ) !== -1, 'data-background worked' );
+ });
+
+
+ // ---------------------------------------------------------------
// EVENT TESTS
QUnit.module( 'Events' );