diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/examples/slide-backgrounds.html | 2 | ||||
-rw-r--r-- | test/simple.md | 12 | ||||
-rw-r--r-- | test/test-markdown-external.html | 36 | ||||
-rw-r--r-- | test/test-markdown-external.js | 24 | ||||
-rw-r--r-- | test/test-markdown-options.html | 41 | ||||
-rw-r--r-- | test/test-markdown-options.js | 26 | ||||
-rw-r--r-- | test/test-markdown.html | 2 | ||||
-rw-r--r-- | test/test.html | 3 | ||||
-rw-r--r-- | test/test.js | 10 |
9 files changed, 152 insertions, 4 deletions
diff --git a/test/examples/slide-backgrounds.html b/test/examples/slide-backgrounds.html index 4e5e406..316c92a 100644 --- a/test/examples/slide-backgrounds.html +++ b/test/examples/slide-backgrounds.html @@ -93,7 +93,7 @@ <h2>Video background</h2> </section> - <section data-background-iframe="https://slides.com"> + <section data-background-iframe="https://slides.com/news/make-better-presentations/embed?style=hidden&autoSlide=4000"> <h2>Iframe background</h2> </section> diff --git a/test/simple.md b/test/simple.md new file mode 100644 index 0000000..c72a440 --- /dev/null +++ b/test/simple.md @@ -0,0 +1,12 @@ +## Slide 1.1 + +```js +var a = 1; +``` + + +## Slide 1.2 + + + +## Slide 2 diff --git a/test/test-markdown-external.html b/test/test-markdown-external.html new file mode 100644 index 0000000..859d0a1 --- /dev/null +++ b/test/test-markdown-external.html @@ -0,0 +1,36 @@ +<!doctype html> +<html lang="en"> + + <head> + <meta charset="utf-8"> + + <title>reveal.js - Test Markdown</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="simple.md" data-separator="^\n\n\n" data-separator-vertical="^\n\n"></section> + </div> + + </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> + <script src="../plugin/markdown/markdown.js"></script> + <script src="qunit-1.12.0.js"></script> + + <script src="test-markdown-external.js"></script> + + </body> +</html> diff --git a/test/test-markdown-external.js b/test/test-markdown-external.js new file mode 100644 index 0000000..cab85c6 --- /dev/null +++ b/test/test-markdown-external.js @@ -0,0 +1,24 @@ + + +Reveal.addEventListener( 'ready', function() { + + QUnit.module( 'Markdown' ); + + test( 'Vertical separator', function() { + strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 2, 'found two slides' ); + }); + + test( 'Horizontal separator', function() { + strictEqual( document.querySelectorAll( '.reveal .slides>section' ).length, 2, 'found two slides' ); + }); + + test( 'Language highlighter', function() { + strictEqual( document.querySelectorAll( '.hljs-keyword' ).length, 1, 'got rendered highlight tag.' ); + 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 new file mode 100644 index 0000000..5b3be97 --- /dev/null +++ b/test/test-markdown-options.html @@ -0,0 +1,41 @@ +<!doctype html> +<html lang="en"> + + <head> + <meta charset="utf-8"> + + <title>reveal.js - Test Markdown Options</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> + <script type="text/template"> + ## Testing Markdown Options + + This "slide" should contain 'smart' quotes. + </script> + </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-markdown-options.js"></script> + + </body> +</html> diff --git a/test/test-markdown-options.js b/test/test-markdown-options.js new file mode 100644 index 0000000..3ae1350 --- /dev/null +++ b/test/test-markdown-options.js @@ -0,0 +1,26 @@ +Reveal.addEventListener( 'ready', function() { + + QUnit.module( 'Markdown' ); + + test( 'Options are set', function() { + strictEqual( marked.defaults.smartypants, true ); + }); + + test( 'Smart quotes are activated', function() { + var text = document.querySelector( '.reveal .slides>section>p' ).textContent; + + strictEqual( /['"]/.test( text ), false ); + strictEqual( /[“”‘’]/.test( text ), true ); + }); + +} ); + +Reveal.initialize({ + dependencies: [ + { src: '../plugin/markdown/marked.js' }, + { src: '../plugin/markdown/markdown.js' }, + ], + markdown: { + smartypants: true + } +}); diff --git a/test/test-markdown.html b/test/test-markdown.html index 7ff0efe..52b39ff 100644 --- a/test/test-markdown.html +++ b/test/test-markdown.html @@ -13,7 +13,7 @@ <body style="overflow: auto;"> <div id="qunit"></div> - <div id="qunit-fixture"></div> + <div id="qunit-fixture"></div> <div class="reveal" style="display: none;"> diff --git a/test/test.html b/test/test.html index 34cf832..d08e4f0 100644 --- a/test/test.html +++ b/test/test.html @@ -24,10 +24,11 @@ <img data-src="fake-url.png"> <video data-src="fake-url.mp4"></video> <audio data-src="fake-url.mp3"></audio> + <aside class="notes">speaker notes 1</aside> </section> <section> - <section data-background="examples/assets/image2.png"> + <section data-background="examples/assets/image2.png" data-notes="speaker notes 2"> <h1>2.1</h1> </section> <section> diff --git a/test/test.js b/test/test.js index 79ff81e..a96b70b 100644 --- a/test/test.js +++ b/test/test.js @@ -89,7 +89,7 @@ Reveal.addEventListener( 'ready', function() { 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 )' ); @@ -139,6 +139,14 @@ Reveal.addEventListener( 'ready', function() { strictEqual( Reveal.getSlideBackground( 1, 100 ), undefined, 'undefined when out of vertical bounds' ); }); + test( 'Reveal.getSlideNotes', function() { + Reveal.slide( 0, 0 ); + ok( Reveal.getSlideNotes() === 'speaker notes 1', 'works with <aside class="notes">' ); + + Reveal.slide( 1, 0 ); + ok( Reveal.getSlideNotes() === 'speaker notes 2', 'works with <section data-notes="">' ); + }); + test( 'Reveal.getPreviousSlide/getCurrentSlide', function() { Reveal.slide( 0, 0 ); Reveal.slide( 1, 0 ); |