aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVonC <vonc@laposte.net>2013-10-14 13:37:48 +0200
committerVonC <vonc@laposte.net>2013-11-04 16:31:37 +0100
commit4def7f116c932b9e713545fcde3054d293647dc9 (patch)
treeffcc72b5a86c1e663b220297fe5dee641762b39d /test
parent83ee2eb00e66124376e404b15ba8ca58d8221f85 (diff)
downloadfreenode-live-2017-presentation-4def7f116c932b9e713545fcde3054d293647dc9.tar
freenode-live-2017-presentation-4def7f116c932b9e713545fcde3054d293647dc9.tar.gz
Add QUnit.js unit tests for attributes in Markdown slides.
Diffstat (limited to 'test')
-rw-r--r--test/test-markdown-attributes.html71
-rw-r--r--test/test-markdown-attributes.js31
2 files changed, 102 insertions, 0 deletions
diff --git a/test/test-markdown-attributes.html b/test/test-markdown-attributes.html
new file mode 100644
index 0000000..780f2be
--- /dev/null
+++ b/test/test-markdown-attributes.html
@@ -0,0 +1,71 @@
+<!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>
+
+ </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
new file mode 100644
index 0000000..a0d8436
--- /dev/null
+++ b/test/test-markdown-attributes.js
@@ -0,0 +1,31 @@
+
+
+Reveal.addEventListener( 'ready', function() {
+
+ QUnit.module( 'Markdown' );
+
+ test( 'Vertical separator', function() {
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 3, 'found three 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"' );
+ });
+
+} );
+
+Reveal.initialize();
+