diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/assets/external-script-a.js | 1 | ||||
-rw-r--r-- | test/assets/external-script-b.js | 1 | ||||
-rw-r--r-- | test/assets/external-script-c.js | 1 | ||||
-rw-r--r-- | test/assets/external-script-d.js | 1 | ||||
-rw-r--r-- | test/examples/embedded-media.html | 1 | ||||
-rw-r--r-- | test/examples/math.html | 2 | ||||
-rw-r--r-- | test/examples/slide-backgrounds.html | 1 | ||||
-rw-r--r-- | test/examples/slide-transitions.html | 1 | ||||
-rw-r--r-- | test/test-dependencies-async.html | 78 | ||||
-rw-r--r-- | test/test-dependencies.html | 54 | ||||
-rw-r--r-- | test/test-markdown-element-attributes.html | 1 | ||||
-rw-r--r-- | test/test-markdown-external.html | 1 | ||||
-rw-r--r-- | test/test-markdown-options.html | 1 | ||||
-rw-r--r-- | test/test-markdown-slide-attributes.html | 1 | ||||
-rw-r--r-- | test/test-markdown.html | 1 | ||||
-rw-r--r-- | test/test-pdf.html | 1 | ||||
-rw-r--r-- | test/test.html | 1 | ||||
-rw-r--r-- | test/test.js | 8 |
18 files changed, 140 insertions, 16 deletions
diff --git a/test/assets/external-script-a.js b/test/assets/external-script-a.js new file mode 100644 index 0000000..cbc8da1 --- /dev/null +++ b/test/assets/external-script-a.js @@ -0,0 +1 @@ +window.externalScriptSequence += 'A';
\ No newline at end of file diff --git a/test/assets/external-script-b.js b/test/assets/external-script-b.js new file mode 100644 index 0000000..e5bca5a --- /dev/null +++ b/test/assets/external-script-b.js @@ -0,0 +1 @@ +window.externalScriptSequence += 'B';
\ No newline at end of file diff --git a/test/assets/external-script-c.js b/test/assets/external-script-c.js new file mode 100644 index 0000000..7d4ccf6 --- /dev/null +++ b/test/assets/external-script-c.js @@ -0,0 +1 @@ +window.externalScriptSequence += 'C';
\ No newline at end of file diff --git a/test/assets/external-script-d.js b/test/assets/external-script-d.js new file mode 100644 index 0000000..1c5925b --- /dev/null +++ b/test/assets/external-script-d.js @@ -0,0 +1 @@ +window.externalScriptSequence += 'D';
\ No newline at end of file diff --git a/test/examples/embedded-media.html b/test/examples/embedded-media.html index bbad4be..312c48c 100644 --- a/test/examples/embedded-media.html +++ b/test/examples/embedded-media.html @@ -34,7 +34,6 @@ </div> - <script src="../../lib/js/head.min.js"></script> <script src="../../js/reveal.js"></script> <script> diff --git a/test/examples/math.html b/test/examples/math.html index 73484d7..0f74a8f 100644 --- a/test/examples/math.html +++ b/test/examples/math.html @@ -175,7 +175,6 @@ </div> - <script src="../../lib/js/head.min.js"></script> <script src="../../js/reveal.js"></script> <script> @@ -196,7 +195,6 @@ }, dependencies: [ - { src: '../../lib/js/classList.js' }, { src: '../../plugin/math/math.js', async: true } ] }); diff --git a/test/examples/slide-backgrounds.html b/test/examples/slide-backgrounds.html index 316c92a..e08d260 100644 --- a/test/examples/slide-backgrounds.html +++ b/test/examples/slide-backgrounds.html @@ -122,7 +122,6 @@ </div> - <script src="../../lib/js/head.min.js"></script> <script src="../../js/reveal.js"></script> <script> diff --git a/test/examples/slide-transitions.html b/test/examples/slide-transitions.html index 88119dc..b7520ab 100644 --- a/test/examples/slide-transitions.html +++ b/test/examples/slide-transitions.html @@ -81,7 +81,6 @@ </div> - <script src="../../lib/js/head.min.js"></script> <script src="../../js/reveal.js"></script> <script> diff --git a/test/test-dependencies-async.html b/test/test-dependencies-async.html new file mode 100644 index 0000000..b36c31b --- /dev/null +++ b/test/test-dependencies-async.html @@ -0,0 +1,78 @@ +<!doctype html> +<html lang="en"> + + <head> + <meta charset="utf-8"> + + <title>reveal.js - Test Async Dependencies</title> + + <link rel="stylesheet" href="../css/reveal.css"> + <link rel="stylesheet" href="qunit-2.5.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>Slide content</section> + + </div> + + </div> + + <script src="../js/reveal.js"></script> + <script src="qunit-2.5.0.js"></script> + + <script> + var externalScriptSequence = ''; + var scriptCount = 0; + + QUnit.config.autostart = false; + QUnit.module( 'Async Dependencies' ); + + QUnit.test( 'Async scripts are loaded', function( assert ) { + assert.expect( 5 ); + var done = assert.async( 5 ); + + function callback( event ) { + if( externalScriptSequence.length === 1 ) { + assert.ok( externalScriptSequence === 'A', 'first callback was sync script' ); + done(); + } + else { + assert.ok( true, 'async script loaded' ); + done(); + } + + if( externalScriptSequence.length === 4 ) { + assert.ok( externalScriptSequence.indexOf( 'A' ) !== -1 && + externalScriptSequence.indexOf( 'B' ) !== -1 && + externalScriptSequence.indexOf( 'C' ) !== -1 && + externalScriptSequence.indexOf( 'D' ) !== -1, 'four unique scripts were loaded' ); + done(); + } + + scriptCount ++; + } + + Reveal.initialize({ + dependencies: [ + { src: 'assets/external-script-a.js', async: false, callback: callback }, + { src: 'assets/external-script-b.js', async: true, callback: callback }, + { src: 'assets/external-script-c.js', async: true, callback: callback }, + { src: 'assets/external-script-d.js', async: true, callback: callback } + ] + }); + }); + + QUnit.start(); + + </script> + + </body> +</html> diff --git a/test/test-dependencies.html b/test/test-dependencies.html new file mode 100644 index 0000000..49aaf60 --- /dev/null +++ b/test/test-dependencies.html @@ -0,0 +1,54 @@ +<!doctype html> +<html lang="en"> + + <head> + <meta charset="utf-8"> + + <title>reveal.js - Test Dependencies</title> + + <link rel="stylesheet" href="../css/reveal.css"> + <link rel="stylesheet" href="qunit-2.5.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>Slide content</section> + + </div> + + </div> + + <script src="../js/reveal.js"></script> + <script src="qunit-2.5.0.js"></script> + + <script> + window.externalScriptSequence = ''; + + Reveal.addEventListener( 'ready', function() { + + QUnit.module( 'Dependencies' ); + + QUnit.test( 'Load synchronous scripts', function( assert ) { + assert.strictEqual( window.externalScriptSequence, 'ABC', 'Loaded and executed in order' ); + }); + + } ); + + Reveal.initialize({ + dependencies: [ + { src: 'assets/external-script-a.js' }, + { src: 'assets/external-script-b.js' }, + { src: 'assets/external-script-c.js' } + ] + }); + </script> + + </body> +</html> diff --git a/test/test-markdown-element-attributes.html b/test/test-markdown-element-attributes.html index 4a09272..409d068 100644 --- a/test/test-markdown-element-attributes.html +++ b/test/test-markdown-element-attributes.html @@ -122,7 +122,6 @@ </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> diff --git a/test/test-markdown-external.html b/test/test-markdown-external.html index d4912b0..76c6ae6 100644 --- a/test/test-markdown-external.html +++ b/test/test-markdown-external.html @@ -23,7 +23,6 @@ </div> - <script src="../lib/js/head.min.js"></script> <script src="../js/reveal.js"></script> <script src="../plugin/highlight/highlight.js"></script> <script src="../plugin/markdown/marked.js"></script> diff --git a/test/test-markdown-options.html b/test/test-markdown-options.html index 598243a..5391a19 100644 --- a/test/test-markdown-options.html +++ b/test/test-markdown-options.html @@ -31,7 +31,6 @@ </div> - <script src="../lib/js/head.min.js"></script> <script src="../js/reveal.js"></script> <script src="qunit-2.5.0.js"></script> diff --git a/test/test-markdown-slide-attributes.html b/test/test-markdown-slide-attributes.html index e90a9cf..ba9e710 100644 --- a/test/test-markdown-slide-attributes.html +++ b/test/test-markdown-slide-attributes.html @@ -116,7 +116,6 @@ </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> diff --git a/test/test-markdown.html b/test/test-markdown.html index 00f7e7a..e1e5926 100644 --- a/test/test-markdown.html +++ b/test/test-markdown.html @@ -40,7 +40,6 @@ </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> diff --git a/test/test-pdf.html b/test/test-pdf.html index 5ab8578..1455fb9 100644 --- a/test/test-pdf.html +++ b/test/test-pdf.html @@ -73,7 +73,6 @@ </div> - <script src="../lib/js/head.min.js"></script> <script src="../js/reveal.js"></script> <script src="qunit-2.5.0.js"></script> diff --git a/test/test.html b/test/test.html index f0a5050..67932b7 100644 --- a/test/test.html +++ b/test/test.html @@ -76,7 +76,6 @@ </div> - <script src="../lib/js/head.min.js"></script> <script src="../js/reveal.js"></script> <script src="qunit-2.5.0.js"></script> diff --git a/test/test.js b/test/test.js index 042e4e8..f8515a0 100644 --- a/test/test.js +++ b/test/test.js @@ -130,8 +130,8 @@ Reveal.addEventListener( 'ready', function() { QUnit.test( 'Reveal.getSlideBackground', function( assert ) { assert.equal( Reveal.getSlideBackground( 0 ), document.querySelector( '.reveal .backgrounds>.slide-background:first-child' ), 'gets correct first background' ); assert.equal( Reveal.getSlideBackground( 1 ), document.querySelector( '.reveal .backgrounds>.slide-background:nth-child(2)' ), 'no v index returns stack' ); - assert.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' ); - assert.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' ); + assert.equal( Reveal.getSlideBackground( 1, 0 ), document.querySelector( '.reveal .backgrounds>.slide-background:nth-child(2) .slide-background:nth-child(2)' ), 'v index 0 returns first vertical child' ); + assert.equal( Reveal.getSlideBackground( 1, 1 ), document.querySelector( '.reveal .backgrounds>.slide-background:nth-child(2) .slide-background:nth-child(3)' ), 'v index 1 returns second vertical child' ); assert.strictEqual( Reveal.getSlideBackground( 100 ), undefined, 'undefined when out of horizontal bounds' ); assert.strictEqual( Reveal.getSlideBackground( 1, 100 ), undefined, 'undefined when out of vertical bounds' ); @@ -523,8 +523,8 @@ Reveal.addEventListener( 'ready', function() { var imageSource2 = Reveal.getSlide( 1, 0 ).getAttribute( 'data-background' ); // check that the images are applied to the background elements - assert.ok( Reveal.getSlideBackground( 0 ).style.backgroundImage.indexOf( imageSource1 ) !== -1, 'data-background-image worked' ); - assert.ok( Reveal.getSlideBackground( 1, 0 ).style.backgroundImage.indexOf( imageSource2 ) !== -1, 'data-background worked' ); + assert.ok( Reveal.getSlideBackground( 0 ).querySelector( '.slide-background-content' ).style.backgroundImage.indexOf( imageSource1 ) !== -1, 'data-background-image worked' ); + assert.ok( Reveal.getSlideBackground( 1, 0 ).querySelector( '.slide-background-content' ).style.backgroundImage.indexOf( imageSource2 ) !== -1, 'data-background worked' ); }); |