aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2020-03-07 18:19:08 +0100
committerHakim El Hattab <hakim.elhattab@gmail.com>2020-03-07 18:19:08 +0100
commit0814176f3c22f511afd88fc0dc514e4c7338a5e7 (patch)
treec895b581607bed2ba5d03166a7790eae2a0c5223 /test
parent20b8def298fd576ac6be3111824e974ad4d5eab5 (diff)
downloadfosdem-2021-minimalism-presentation-0814176f3c22f511afd88fc0dc514e4c7338a5e7.tar
fosdem-2021-minimalism-presentation-0814176f3c22f511afd88fc0dc514e4c7338a5e7.tar.gz
refactor unit tests, now consistently initializing reveal.js in the same way
Diffstat (limited to 'test')
-rw-r--r--test/test-auto-animate.html7
-rw-r--r--test/test-dependencies-async.html3
-rw-r--r--test/test-dependencies.html19
-rw-r--r--test/test-grid-navigation.html7
-rw-r--r--test/test-iframe-backgrounds.html10
-rw-r--r--test/test-iframes.html10
-rw-r--r--test/test-markdown-element-attributes.html55
-rw-r--r--test/test-markdown-element-attributes.js44
-rw-r--r--test/test-markdown-external.html28
-rw-r--r--test/test-markdown-external.js20
-rw-r--r--test/test-markdown-options.html31
-rw-r--r--test/test-markdown-options.js27
-rw-r--r--test/test-markdown-slide-attributes.html54
-rw-r--r--test/test-markdown-slide-attributes.js44
-rw-r--r--test/test-markdown.html22
-rw-r--r--test/test-markdown.js11
-rw-r--r--test/test-pdf.html15
-rw-r--r--test/test-pdf.js12
-rw-r--r--test/test-plugins.html29
-rw-r--r--test/test-state.html7
-rw-r--r--test/test.html3
-rw-r--r--test/test.js4
22 files changed, 216 insertions, 246 deletions
diff --git a/test/test-auto-animate.html b/test/test-auto-animate.html
index 19e0419..d3d9b4f 100644
--- a/test/test-auto-animate.html
+++ b/test/test-auto-animate.html
@@ -8,6 +8,7 @@
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="qunit-2.5.0.css">
+ <script src="qunit-2.5.0.js"></script>
</head>
<body style="overflow: auto;">
@@ -46,8 +47,6 @@
</div>
<script src="../dist/reveal.min.js"></script>
- <script src="qunit-2.5.0.js"></script>
-
<script>
const slides = Array.prototype.map.call( document.querySelectorAll( '.slides section' ), slide => {
@@ -59,7 +58,7 @@
};
} );
- Reveal.addEventListener( 'ready', () => {
+ Reveal.initialize().then( () => {
QUnit.module( 'Auto-Animate' );
@@ -121,8 +120,6 @@
});
} );
-
- Reveal.initialize();
</script>
</body>
diff --git a/test/test-dependencies-async.html b/test/test-dependencies-async.html
index 78e9f01..2a54fae 100644
--- a/test/test-dependencies-async.html
+++ b/test/test-dependencies-async.html
@@ -8,6 +8,7 @@
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="qunit-2.5.0.css">
+ <script src="qunit-2.5.0.js"></script>
</head>
<body style="overflow: auto;">
@@ -26,8 +27,6 @@
</div>
<script src="../dist/reveal.min.js"></script>
- <script src="qunit-2.5.0.js"></script>
-
<script>
var externalScriptSequence = '';
var scriptCount = 0;
diff --git a/test/test-dependencies.html b/test/test-dependencies.html
index 4879195..20c017e 100644
--- a/test/test-dependencies.html
+++ b/test/test-dependencies.html
@@ -8,6 +8,7 @@
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="qunit-2.5.0.css">
+ <script src="qunit-2.5.0.js"></script>
</head>
<body style="overflow: auto;">
@@ -26,12 +27,16 @@
</div>
<script src="../dist/reveal.min.js"></script>
- <script src="qunit-2.5.0.js"></script>
-
<script>
window.externalScriptSequence = '';
- Reveal.addEventListener( 'ready', function() {
+ Reveal.initialize({
+ dependencies: [
+ { src: 'assets/external-script-a.js' },
+ { src: 'assets/external-script-b.js' },
+ { src: 'assets/external-script-c.js' }
+ ]
+ }).then( () => {
QUnit.module( 'Dependencies' );
@@ -40,14 +45,6 @@
});
} );
-
- Reveal.initialize({
- dependencies: [
- { src: 'assets/external-script-a.js' },
- { src: 'assets/external-script-b.js' },
- { src: 'assets/external-script-c.js' }
- ]
- });
</script>
</body>
diff --git a/test/test-grid-navigation.html b/test/test-grid-navigation.html
index b53dcb3..2a943fe 100644
--- a/test/test-grid-navigation.html
+++ b/test/test-grid-navigation.html
@@ -8,6 +8,7 @@
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="qunit-2.5.0.css">
+ <script src="qunit-2.5.0.js"></script>
</head>
<body style="overflow: auto;">
@@ -38,10 +39,8 @@
</div>
<script src="../dist/reveal.min.js"></script>
- <script src="qunit-2.5.0.js"></script>
-
<script>
- Reveal.addEventListener( 'ready', function() {
+ Reveal.initialize().then( () => {
QUnit.module( 'Grid Navigation' );
@@ -66,8 +65,6 @@
});
} );
-
- Reveal.initialize();
</script>
</body>
diff --git a/test/test-iframe-backgrounds.html b/test/test-iframe-backgrounds.html
index 59e7aed..e09b2d7 100644
--- a/test/test-iframe-backgrounds.html
+++ b/test/test-iframe-backgrounds.html
@@ -8,6 +8,7 @@
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="qunit-2.5.0.css">
+ <script src="qunit-2.5.0.js"></script>
</head>
<body style="overflow: auto;">
@@ -31,12 +32,9 @@
</div>
<script src="../dist/reveal.min.js"></script>
- <script src="qunit-2.5.0.js"></script>
-
<script>
-
- Reveal.addEventListener( 'ready', function() {
+ Reveal.initialize({ viewDistance: 3 }).then( () => {
function getIframe( index ) {
return document.querySelectorAll( '.slide-background' )[index].querySelector( 'iframe' );
@@ -94,10 +92,6 @@
});
} );
-
- Reveal.initialize({
- viewDistance: 3
- });
</script>
</body>
diff --git a/test/test-iframes.html b/test/test-iframes.html
index b2b7d96..44b5e23 100644
--- a/test/test-iframes.html
+++ b/test/test-iframes.html
@@ -8,6 +8,7 @@
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="qunit-2.5.0.css">
+ <script src="qunit-2.5.0.js"></script>
</head>
<body style="overflow: auto;">
@@ -31,12 +32,9 @@
</div>
<script src="../dist/reveal.min.js"></script>
- <script src="qunit-2.5.0.js"></script>
-
<script>
-
- Reveal.addEventListener( 'ready', function() {
+ Reveal.initialize({ viewDistance: 2 }).then( () => {
var defaultIframe = document.querySelector( '.default-iframe' ),
preloadIframe = document.querySelector( '.preload-iframe' );
@@ -98,10 +96,6 @@
});
} );
-
- Reveal.initialize({
- viewDistance: 2
- });
</script>
</body>
diff --git a/test/test-markdown-element-attributes.html b/test/test-markdown-element-attributes.html
index ce8ca46..acc93d1 100644
--- a/test/test-markdown-element-attributes.html
+++ b/test/test-markdown-element-attributes.html
@@ -8,6 +8,7 @@
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="qunit-2.5.0.css">
+ <script src="qunit-2.5.0.js"></script>
</head>
<body style="overflow: auto;">
@@ -122,11 +123,55 @@
</div>
<script src="../dist/reveal.min.js"></script>
- <script src="../plugin/markdown/marked.js"></script>
- <script src="../plugin/markdown/markdown.js"></script>
- <script src="qunit-2.5.0.js"></script>
-
- <script src="test-markdown-element-attributes.js"></script>
+ <script>
+ Reveal.initialize({
+ dependencies: [
+ { src: '../plugin/markdown/marked.js' },
+ { src: '../plugin/markdown/markdown.js' },
+ ]
+ }).then( function() {
+
+ QUnit.module( 'Markdown' );
+
+ QUnit.test( 'Vertical separator', function( assert ) {
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 4, 'found four slides' );
+ });
+
+ QUnit.test( 'Attributes on element header in vertical slides', function( assert ) {
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides section>section h2.fragment.fade-out' ).length, 1, 'found one vertical slide with class fragment.fade-out on header' );
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides section>section h2.fragment.shrink' ).length, 1, 'found one vertical slide with class fragment.shrink on header' );
+ });
+
+ QUnit.test( 'Attributes on element paragraphs in vertical slides', function( assert ) {
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides section>section p.fragment.grow' ).length, 2, 'found a vertical slide with two paragraphs with class fragment.grow' );
+ });
+
+ QUnit.test( 'Attributes on element list items in vertical slides', function( assert ) {
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides section>section li.fragment.grow' ).length, 3, 'found a vertical slide with three list items with class fragment.grow' );
+ });
+
+ QUnit.test( 'Attributes on element paragraphs in horizontal slides', function( assert ) {
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides section p.fragment.highlight-red' ).length, 4, 'found a horizontal slide with four paragraphs with class fragment.grow' );
+ });
+
+ QUnit.test( 'Attributes on element list items in horizontal slides', function( assert ) {
+ assert.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' );
+ });
+
+ QUnit.test( 'Attributes on element image in horizontal slides', function( assert ) {
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides section img.reveal.stretch' ).length, 1, 'found a horizontal slide with stretched image, class img.reveal.stretch' );
+ });
+
+ QUnit.test( 'Attributes on elements in vertical slides with default element attribute separator', function( assert ) {
+ assert.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' );
+ });
+
+ QUnit.test( 'Attributes on elements in single slides with default element attribute separator', function( assert ) {
+ assert.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' );
+ });
+
+ } );
+ </script>
</body>
</html>
diff --git a/test/test-markdown-element-attributes.js b/test/test-markdown-element-attributes.js
deleted file mode 100644
index fc87b7b..0000000
--- a/test/test-markdown-element-attributes.js
+++ /dev/null
@@ -1,44 +0,0 @@
-Reveal.addEventListener( 'ready', function() {
-
- QUnit.module( 'Markdown' );
-
- QUnit.test( 'Vertical separator', function( assert ) {
- assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 4, 'found four slides' );
- });
-
- QUnit.test( 'Attributes on element header in vertical slides', function( assert ) {
- assert.strictEqual( document.querySelectorAll( '.reveal .slides section>section h2.fragment.fade-out' ).length, 1, 'found one vertical slide with class fragment.fade-out on header' );
- assert.strictEqual( document.querySelectorAll( '.reveal .slides section>section h2.fragment.shrink' ).length, 1, 'found one vertical slide with class fragment.shrink on header' );
- });
-
- QUnit.test( 'Attributes on element paragraphs in vertical slides', function( assert ) {
- assert.strictEqual( document.querySelectorAll( '.reveal .slides section>section p.fragment.grow' ).length, 2, 'found a vertical slide with two paragraphs with class fragment.grow' );
- });
-
- QUnit.test( 'Attributes on element list items in vertical slides', function( assert ) {
- assert.strictEqual( document.querySelectorAll( '.reveal .slides section>section li.fragment.grow' ).length, 3, 'found a vertical slide with three list items with class fragment.grow' );
- });
-
- QUnit.test( 'Attributes on element paragraphs in horizontal slides', function( assert ) {
- assert.strictEqual( document.querySelectorAll( '.reveal .slides section p.fragment.highlight-red' ).length, 4, 'found a horizontal slide with four paragraphs with class fragment.grow' );
- });
-
- QUnit.test( 'Attributes on element list items in horizontal slides', function( assert ) {
- assert.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' );
- });
-
- QUnit.test( 'Attributes on element image in horizontal slides', function( assert ) {
- assert.strictEqual( document.querySelectorAll( '.reveal .slides section img.reveal.stretch' ).length, 1, 'found a horizontal slide with stretched image, class img.reveal.stretch' );
- });
-
- QUnit.test( 'Attributes on elements in vertical slides with default element attribute separator', function( assert ) {
- assert.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' );
- });
-
- QUnit.test( 'Attributes on elements in single slides with default element attribute separator', function( assert ) {
- assert.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-external.html b/test/test-markdown-external.html
index 4db4228..333bbbd 100644
--- a/test/test-markdown-external.html
+++ b/test/test-markdown-external.html
@@ -18,20 +18,34 @@
<div class="reveal" style="display: none;">
<div class="slides">
- <!-- <section data-markdown="simple.md" data-separator="^\r?\n\r?\n\r?\n" data-separator-vertical="^\r?\n\r?\n"></section> -->
+ <section data-markdown="simple.md" data-separator="^\r?\n\r?\n\r?\n" data-separator-vertical="^\r?\n\r?\n"></section>
</div>
</div>
- <script src="../dist/reveal.min.js"></script>
- <script src="../plugin/highlight/highlight.js"></script>
- <script src="../plugin/markdown/marked.js"></script>
- <script src="../plugin/markdown/markdown.js"></script>
<script src="qunit-2.5.0.js"></script>
+ <script src="../dist/reveal.min.js"></script>
+
+ <script>
+ Reveal.initialize({
+ dependencies: [
+ { src: '../plugin/markdown/marked.js' },
+ { src: '../plugin/markdown/markdown.js' },
+ ]
+ }).then( function() {
+
+ QUnit.module( 'Markdown' );
+
+ QUnit.test( 'Vertical separator', function( assert ) {
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 2, 'found two slides' );
+ });
- <!-- <script src="test-markdown-external.js"></script> -->
+ QUnit.test( 'Horizontal separator', function( assert ) {
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides>section' ).length, 2, 'found two slides' );
+ });
- <!-- Test disabled 28/2/2019 by Hakim – Markdown plugin needs to be updated to load extenal files asycnhronously -->
+ } );
+ </script>
</body>
</html>
diff --git a/test/test-markdown-external.js b/test/test-markdown-external.js
deleted file mode 100644
index f924986..0000000
--- a/test/test-markdown-external.js
+++ /dev/null
@@ -1,20 +0,0 @@
-Reveal.addEventListener( 'ready', function() {
-
- QUnit.module( 'Markdown' );
-
- QUnit.test( 'Vertical separator', function( assert ) {
- assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 2, 'found two slides' );
- });
-
- QUnit.test( 'Horizontal separator', function( assert ) {
- assert.strictEqual( document.querySelectorAll( '.reveal .slides>section' ).length, 2, 'found two slides' );
- });
-
- QUnit.test( 'Language highlighter', function( assert ) {
- assert.strictEqual( document.querySelectorAll( '.hljs-keyword' ).length, 1, 'got rendered highlight tag.' );
- assert.strictEqual( document.querySelector( '.hljs-keyword' ).innerHTML, 'var', 'the same keyword: var.' );
- });
-
-} );
-
-Reveal.initialize();
diff --git a/test/test-markdown-options.html b/test/test-markdown-options.html
index 653f858..7b2a631 100644
--- a/test/test-markdown-options.html
+++ b/test/test-markdown-options.html
@@ -31,10 +31,37 @@
</div>
- <script src="../dist/reveal.min.js"></script>
<script src="qunit-2.5.0.js"></script>
+ <script src="../dist/reveal.min.js"></script>
+
+ <script>
+ Reveal.initialize({
+ dependencies: [
+ { src: '../plugin/markdown/marked.js' },
+ // Test loading JS files with query strings
+ { src: '../plugin/markdown/markdown.js?query=string' },
+ ],
+ markdown: {
+ smartypants: true
+ }
+ }).then( function() {
+
+ QUnit.module( 'Markdown' );
+
+ QUnit.test( 'Options are set', function( assert ) {
+ assert.strictEqual( marked.defaults.smartypants, true );
+ });
+
+ QUnit.test( 'Smart quotes are activated', function( assert ) {
+ var text = document.querySelector( '.reveal .slides>section>p' ).textContent;
+
+ assert.strictEqual( /['"]/.test( text ), false );
+ assert.strictEqual( /[“”‘’]/.test( text ), true );
+ });
+
+ } );
- <script src="test-markdown-options.js"></script>
+ </script>
</body>
</html>
diff --git a/test/test-markdown-options.js b/test/test-markdown-options.js
deleted file mode 100644
index ef61659..0000000
--- a/test/test-markdown-options.js
+++ /dev/null
@@ -1,27 +0,0 @@
-Reveal.addEventListener( 'ready', function() {
-
- QUnit.module( 'Markdown' );
-
- QUnit.test( 'Options are set', function( assert ) {
- assert.strictEqual( marked.defaults.smartypants, true );
- });
-
- QUnit.test( 'Smart quotes are activated', function( assert ) {
- var text = document.querySelector( '.reveal .slides>section>p' ).textContent;
-
- assert.strictEqual( /['"]/.test( text ), false );
- assert.strictEqual( /[“”‘’]/.test( text ), true );
- });
-
-} );
-
-Reveal.initialize({
- dependencies: [
- { src: '../plugin/markdown/marked.js' },
- // Test loading JS files with query strings
- { src: '../plugin/markdown/markdown.js?query=string' },
- ],
- markdown: {
- smartypants: true
- }
-});
diff --git a/test/test-markdown-slide-attributes.html b/test/test-markdown-slide-attributes.html
index a596019..274a87f 100644
--- a/test/test-markdown-slide-attributes.html
+++ b/test/test-markdown-slide-attributes.html
@@ -116,12 +116,58 @@
</div>
- <script src="../dist/reveal.min.js"></script>
- <script src="../plugin/markdown/marked.js"></script>
- <script src="../plugin/markdown/markdown.js"></script>
<script src="qunit-2.5.0.js"></script>
+ <script src="../dist/reveal.min.js"></script>
- <script src="test-markdown-slide-attributes.js"></script>
+ <script>
+ Reveal.initialize({
+ dependencies: [
+ { src: '../plugin/markdown/marked.js' },
+ { src: '../plugin/markdown/markdown.js' },
+ ]
+ }).then( function() {
+
+ QUnit.module( 'Markdown' );
+
+ QUnit.test( 'Vertical separator', function( assert ) {
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 6, 'found six vertical slides' );
+ });
+
+ QUnit.test( 'Id on slide', function( assert ) {
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section#slide2' ).length, 1, 'found one slide with id slide2' );
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section a[href="#/slide2"]' ).length, 1, 'found one slide with a link to slide2' );
+ });
+
+ QUnit.test( 'data-background attributes', function( assert ) {
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#A0C66B"]' ).length, 1, 'found one vertical slide with data-background="#A0C66B"' );
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#ff0000"]' ).length, 1, 'found one vertical slide with data-background="#ff0000"' );
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides>section[data-background="#C6916B"]' ).length, 1, 'found one slide with data-background="#C6916B"' );
+ });
+
+ QUnit.test( 'data-transition attributes', function( assert ) {
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="zoom"]' ).length, 1, 'found one vertical slide with data-transition="zoom"' );
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="fade"]' ).length, 1, 'found one vertical slide with data-transition="fade"' );
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides section [data-transition="zoom"]' ).length, 1, 'found one slide with data-transition="zoom"' );
+ });
+
+ QUnit.test( 'data-background attributes with default separator', function( assert ) {
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#A7C66B"]' ).length, 1, 'found one vertical slide with data-background="#A0C66B"' );
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#f70000"]' ).length, 1, 'found one vertical slide with data-background="#ff0000"' );
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides>section[data-background="#C7916B"]' ).length, 1, 'found one slide with data-background="#C6916B"' );
+ });
+
+ QUnit.test( 'data-transition attributes with default separator', function( assert ) {
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="concave"]' ).length, 1, 'found one vertical slide with data-transition="zoom"' );
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="page"]' ).length, 1, 'found one vertical slide with data-transition="fade"' );
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides section [data-transition="concave"]' ).length, 1, 'found one slide with data-transition="zoom"' );
+ });
+
+ QUnit.test( 'data-transition attributes with inline content', function( assert ) {
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides>section[data-background="#ff0000"]' ).length, 3, 'found three horizontal slides with data-background="#ff0000"' );
+ });
+
+ } );
+ </script>
</body>
</html>
diff --git a/test/test-markdown-slide-attributes.js b/test/test-markdown-slide-attributes.js
deleted file mode 100644
index b44323a..0000000
--- a/test/test-markdown-slide-attributes.js
+++ /dev/null
@@ -1,44 +0,0 @@
-Reveal.addEventListener( 'ready', function() {
-
- QUnit.module( 'Markdown' );
-
- QUnit.test( 'Vertical separator', function( assert ) {
- assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 6, 'found six vertical slides' );
- });
-
- QUnit.test( 'Id on slide', function( assert ) {
- assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section#slide2' ).length, 1, 'found one slide with id slide2' );
- assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section a[href="#/slide2"]' ).length, 1, 'found one slide with a link to slide2' );
- });
-
- QUnit.test( 'data-background attributes', function( assert ) {
- assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#A0C66B"]' ).length, 1, 'found one vertical slide with data-background="#A0C66B"' );
- assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#ff0000"]' ).length, 1, 'found one vertical slide with data-background="#ff0000"' );
- assert.strictEqual( document.querySelectorAll( '.reveal .slides>section[data-background="#C6916B"]' ).length, 1, 'found one slide with data-background="#C6916B"' );
- });
-
- QUnit.test( 'data-transition attributes', function( assert ) {
- assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="zoom"]' ).length, 1, 'found one vertical slide with data-transition="zoom"' );
- assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="fade"]' ).length, 1, 'found one vertical slide with data-transition="fade"' );
- assert.strictEqual( document.querySelectorAll( '.reveal .slides section [data-transition="zoom"]' ).length, 1, 'found one slide with data-transition="zoom"' );
- });
-
- QUnit.test( 'data-background attributes with default separator', function( assert ) {
- assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#A7C66B"]' ).length, 1, 'found one vertical slide with data-background="#A0C66B"' );
- assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#f70000"]' ).length, 1, 'found one vertical slide with data-background="#ff0000"' );
- assert.strictEqual( document.querySelectorAll( '.reveal .slides>section[data-background="#C7916B"]' ).length, 1, 'found one slide with data-background="#C6916B"' );
- });
-
- QUnit.test( 'data-transition attributes with default separator', function( assert ) {
- assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="concave"]' ).length, 1, 'found one vertical slide with data-transition="zoom"' );
- assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="page"]' ).length, 1, 'found one vertical slide with data-transition="fade"' );
- assert.strictEqual( document.querySelectorAll( '.reveal .slides section [data-transition="concave"]' ).length, 1, 'found one slide with data-transition="zoom"' );
- });
-
- QUnit.test( 'data-transition attributes with inline content', function( assert ) {
- assert.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 c6b5542..9233fe4 100644
--- a/test/test-markdown.html
+++ b/test/test-markdown.html
@@ -8,6 +8,7 @@
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="qunit-2.5.0.css">
+ <script src="qunit-2.5.0.js"></script>
</head>
<body style="overflow: auto;">
@@ -41,11 +42,22 @@
</div>
<script src="../dist/reveal.min.js"></script>
- <script src="../plugin/markdown/marked.js"></script>
- <script src="../plugin/markdown/markdown.js"></script>
- <script src="qunit-2.5.0.js"></script>
-
- <script src="test-markdown.js"></script>
+ <script>
+ Reveal.initialize({
+ dependencies: [
+ { src: '../plugin/markdown/marked.js' },
+ { src: '../plugin/markdown/markdown.js' },
+ ]
+ }).then( function() {
+
+ QUnit.module( 'Markdown' );
+
+ QUnit.test( 'Vertical separator', function( assert ) {
+ assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 2, 'found two slides' );
+ });
+
+ } );
+ </script>
</body>
</html>
diff --git a/test/test-markdown.js b/test/test-markdown.js
deleted file mode 100644
index 5ea8bf2..0000000
--- a/test/test-markdown.js
+++ /dev/null
@@ -1,11 +0,0 @@
-Reveal.addEventListener( 'ready', function() {
-
- QUnit.module( 'Markdown' );
-
- QUnit.test( 'Vertical separator', function( assert ) {
- assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 2, 'found two slides' );
- });
-
-} );
-
-Reveal.initialize();
diff --git a/test/test-pdf.html b/test/test-pdf.html
index 09ffa22..ee9591d 100644
--- a/test/test-pdf.html
+++ b/test/test-pdf.html
@@ -9,6 +9,7 @@
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../css/print/pdf.css">
<link rel="stylesheet" href="qunit-2.5.0.css">
+ <script src="qunit-2.5.0.js"></script>
</head>
<body style="overflow: auto;">
@@ -74,9 +75,19 @@
</div>
<script src="../dist/reveal.min.js"></script>
- <script src="qunit-2.5.0.js"></script>
+ <script>
+ Reveal.initialize({ pdf: true }).then( function() {
+
+ // Only one test for now, we're mainly ensuring that there
+ // are no execution errors when running PDF mode
+
+ QUnit.test( 'Reveal.isReady', function( assert ) {
+ assert.strictEqual( Reveal.isReady(), true, 'returns true' );
+ });
+
+ } );
- <script src="test-pdf.js"></script>
+ </script>
</body>
</html>
diff --git a/test/test-pdf.js b/test/test-pdf.js
deleted file mode 100644
index 1ebf997..0000000
--- a/test/test-pdf.js
+++ /dev/null
@@ -1,12 +0,0 @@
-Reveal.addEventListener( 'ready', function() {
-
- // Only one test for now, we're mainly ensuring that there
- // are no execution errors when running PDF mode
-
- QUnit.test( 'Reveal.isReady', function( assert ) {
- assert.strictEqual( Reveal.isReady(), true, 'returns true' );
- });
-
-} );
-
-Reveal.initialize({ pdf: true });
diff --git a/test/test-plugins.html b/test/test-plugins.html
index 4bdbfd2..47f530b 100644
--- a/test/test-plugins.html
+++ b/test/test-plugins.html
@@ -8,6 +8,7 @@
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="qunit-2.5.0.css">
+ <script src="qunit-2.5.0.js"></script>
</head>
<body style="overflow: auto;">
@@ -26,8 +27,6 @@
</div>
<script src="../dist/reveal.min.js"></script>
- <script src="qunit-2.5.0.js"></script>
-
<script>
QUnit.module( 'Plugins' );
@@ -59,16 +58,18 @@
var PluginE = {};
- Reveal.registerPlugin( 'PluginA', PluginA );
- Reveal.registerPlugin( 'PluginB', PluginB );
- Reveal.registerPlugin( 'PluginC', PluginC );
+ var reveal = new Reveal();
+
+ reveal.registerPlugin( 'PluginA', PluginA );
+ reveal.registerPlugin( 'PluginB', PluginB );
+ reveal.registerPlugin( 'PluginC', PluginC );
- Reveal.initialize();
+ reveal.initialize();
QUnit.test( 'Can initialize synchronously', function( assert ) {
assert.strictEqual( initCounter['PluginB'], 1 );
- Reveal.registerPlugin( 'PluginB', PluginB );
+ reveal.registerPlugin( 'PluginB', PluginB );
assert.strictEqual( initCounter['PluginB'], 1, 'prevents duplicate registration' );
});
@@ -79,25 +80,25 @@
assert.strictEqual( initCounter['PluginC'], 0, 'async plugin not immediately initialized' );
- Reveal.addEventListener( 'ready', function() {
+ reveal.addEventListener( 'ready', function() {
assert.strictEqual( initCounter['PluginC'], 1, 'finsihed initializing when reveal.js dispatches "ready"' );
done();
- Reveal.registerPlugin( 'PluginD', PluginD );
+ reveal.registerPlugin( 'PluginD', PluginD );
assert.strictEqual( initCounter['PluginD'], 1, 'plugin registered after reveal.js is ready still initiailizes' );
done();
});
} );
QUnit.test( 'Can check if plugin is registered', function( assert ) {
- assert.strictEqual( Reveal.hasPlugin( 'PluginA' ), true );
- assert.strictEqual( Reveal.hasPlugin( 'PluginE' ), false );
- Reveal.registerPlugin( 'PluginE', PluginE );
- assert.strictEqual( Reveal.hasPlugin( 'PluginE' ), true );
+ assert.strictEqual( reveal.hasPlugin( 'PluginA' ), true );
+ assert.strictEqual( reveal.hasPlugin( 'PluginE' ), false );
+ reveal.registerPlugin( 'PluginE', PluginE );
+ assert.strictEqual( reveal.hasPlugin( 'PluginE' ), true );
} );
QUnit.test( 'Can retrieve plugin instance', function( assert ) {
- assert.strictEqual( Reveal.getPlugin( 'PluginB' ), PluginB );
+ assert.strictEqual( reveal.getPlugin( 'PluginB' ), PluginB );
} );
</script>
diff --git a/test/test-state.html b/test/test-state.html
index 61736d0..9fca96e 100644
--- a/test/test-state.html
+++ b/test/test-state.html
@@ -8,6 +8,7 @@
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="qunit-2.5.0.css">
+ <script src="qunit-2.5.0.js"></script>
</head>
<body style="overflow: auto;">
@@ -36,12 +37,10 @@
</div>
<script src="../dist/reveal.min.js"></script>
- <script src="qunit-2.5.0.js"></script>
-
<script>
- Reveal.addEventListener( 'ready', function() {
+ Reveal.initialize().then( function() {
QUnit.module( 'State' );
@@ -131,8 +130,6 @@
});
} );
-
- Reveal.initialize();
</script>
</body>
diff --git a/test/test.html b/test/test.html
index 2e9b3d2..5f64d6e 100644
--- a/test/test.html
+++ b/test/test.html
@@ -8,6 +8,7 @@
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="qunit-2.5.0.css">
+ <script src="qunit-2.5.0.js"></script>
</head>
<body style="overflow: auto;">
@@ -77,8 +78,6 @@
</div>
<script src="../dist/reveal.min.js"></script>
- <script src="qunit-2.5.0.js"></script>
-
<script src="test.js"></script>
</body>
diff --git a/test/test.js b/test/test.js
index 14bb690..a6bb0cc 100644
--- a/test/test.js
+++ b/test/test.js
@@ -7,7 +7,7 @@
// 3 - Two fragments with same data-fragment-index
// 4
-Reveal.addEventListener( 'ready', function() {
+Reveal.initialize().then( function() {
// ---------------------------------------------------------------
// DOM TESTS
@@ -610,5 +610,3 @@ Reveal.addEventListener( 'ready', function() {
});
} );
-
-Reveal.initialize();