Skip to content

Commit 78dfbf5

Browse files
committed
test-markdown-element-attributes: formats and test.
- Reformat - Use new default separator format: '.element: x=y' - Add new tests for testing that default format
1 parent d4e04b8 commit 78dfbf5

File tree

2 files changed

+75
-32
lines changed

2 files changed

+75
-32
lines changed

test/test-markdown-element-attributes.html

Lines changed: 60 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<head>
55
<meta charset="utf-8">
66

7-
<title>reveal.js - Test Markdown</title>
7+
<title>reveal.js - Test Markdown Element Attributes</title>
88

99
<link rel="stylesheet" href="../css/reveal.min.css">
1010
<link rel="stylesheet" href="qunit-1.12.0.css">
@@ -13,9 +13,9 @@
1313
<body style="overflow: auto;">
1414

1515
<div id="qunit"></div>
16-
<div id="qunit-fixture"></div>
16+
<div id="qunit-fixture"></div>
1717

18-
<div class="reveal" style="display: true;">
18+
<div class="reveal" style="display: none;">
1919

2020
<div class="slides">
2121

@@ -38,12 +38,9 @@
3838
Paragraph 2
3939
<!-- {_class="fragment grow"} -->
4040

41-
- list item 1
42-
<!-- {_class="fragment roll-in"} -->
43-
- list item 2
44-
<!-- {_class="fragment roll-in"} -->
45-
- list item 3
46-
<!-- {_class="fragment roll-in"} -->
41+
- list item 1 <!-- {_class="fragment roll-in"} -->
42+
- list item 2 <!-- {_class="fragment roll-in"} -->
43+
- list item 3 <!-- {_class="fragment roll-in"} -->
4744

4845

4946
---
@@ -52,28 +49,20 @@
5249

5350

5451
Paragraph 1.2
55-
multi-line
56-
<!-- {_class="fragment highlight-red"} -->
52+
multi-line <!-- {_class="fragment highlight-red"} -->
5753

58-
Paragraph 2.2
59-
<!-- {_class="fragment highlight-red"} -->
54+
Paragraph 2.2 <!-- {_class="fragment highlight-red"} -->
6055

61-
Paragraph 2.3
62-
<!-- {_class="fragment highlight-red"} -->
56+
Paragraph 2.3 <!-- {_class="fragment highlight-red"} -->
6357

64-
Paragraph 2.4
65-
<!-- {_class="fragment highlight-red"} -->
58+
Paragraph 2.4 <!-- {_class="fragment highlight-red"} -->
6659

67-
- list item 1
68-
<!-- {_class="fragment highlight-green"} -->
69-
- list item 2
70-
<!-- {_class="fragment highlight-green"} -->
71-
- list item 3
72-
<!-- {_class="fragment highlight-green"} -->
60+
- list item 1 <!-- {_class="fragment highlight-green"} -->
61+
- list item 2<!-- {_class="fragment highlight-green"} -->
62+
- list item 3<!-- {_class="fragment highlight-green"} -->
7363
- list item 4
7464
<!-- {_class="fragment highlight-green"} -->
75-
- list item 5
76-
<!-- {_class="fragment highlight-green"} -->
65+
- list item 5<!-- {_class="fragment highlight-green"} -->
7766

7867
Test
7968

@@ -83,6 +72,52 @@
8372
</script>
8473
</section>
8574

75+
76+
77+
<section data-markdown data-separator="^\n\n\n"
78+
data-vertical="^\n\n"
79+
data-notes="^Note:"
80+
data-charset="utf-8">
81+
<script type="text/template">
82+
# Test attributes in Markdown with default separator
83+
## Slide 1 Def <!-- .element: class="fragment highlight-red" data-fragment-index="1" -->
84+
85+
86+
## Slide 2 Def
87+
<!-- .element: class="fragment highlight-red" -->
88+
89+
</script>
90+
</section>
91+
92+
<section data-markdown>
93+
<script type="text/template">
94+
## Hello world
95+
A paragraph
96+
<!-- .element: class="fragment highlight-blue" -->
97+
</script>
98+
</section>
99+
100+
<section data-markdown>
101+
<script type="text/template">
102+
## Hello world
103+
104+
Multiple
105+
Line
106+
<!-- .element: class="fragment highlight-blue" -->
107+
</script>
108+
</section>
109+
110+
<section data-markdown>
111+
<script type="text/template">
112+
## Hello world
113+
114+
Test<!-- .element: class="fragment highlight-blue" -->
115+
116+
More Test
117+
</script>
118+
</section>
119+
120+
86121
</div>
87122

88123
</div>

test/test-markdown-element-attributes.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,41 @@ Reveal.addEventListener( 'ready', function() {
55
QUnit.module( 'Markdown' );
66

77
test( 'Vertical separator', function() {
8-
strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 2, 'found two slides' );
8+
strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 4, 'found four slides' );
99
});
1010

1111

12-
test( 'Attributes on vertical slides header', function() {
12+
test( 'Attributes on element header in vertical slides', function() {
1313
strictEqual( document.querySelectorAll( '.reveal .slides section>section h2.fragment.fade-out' ).length, 1, 'found one vertical slide with class fragment.fade-out on header' );
1414
strictEqual( document.querySelectorAll( '.reveal .slides section>section h2.fragment.shrink' ).length, 1, 'found one vertical slide with class fragment.shrink on header' );
1515
});
1616

17-
test( 'Attributes on vertical slides paragraphs', function() {
17+
test( 'Attributes on element paragraphs in vertical slides', function() {
1818
strictEqual( document.querySelectorAll( '.reveal .slides section>section p.fragment.grow' ).length, 2, 'found a vertical slide with two paragraphs with class fragment.grow' );
1919
});
2020

21-
test( 'Attributes on vertical slides list items', function() {
21+
test( 'Attributes on element list items in vertical slides', function() {
2222
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' );
2323
});
2424

25-
test( 'Attributes on horizontal slides paragraphs', function() {
25+
test( 'Attributes on element paragraphs in horizontal slides', function() {
2626
strictEqual( document.querySelectorAll( '.reveal .slides section p.fragment.highlight-red' ).length, 4, 'found a horizontal slide with four paragraphs with class fragment.grow' );
2727
});
28-
test( 'Attributes on horizontal slides list items', function() {
28+
test( 'Attributes on element list items in horizontal slides', function() {
2929
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' );
3030
});
31-
test( 'Attributes on horizontal slides list items', function() {
31+
test( 'Attributes on element list items in horizontal slides', function() {
3232
strictEqual( document.querySelectorAll( '.reveal .slides section img.reveal.stretch' ).length, 1, 'found a horizontal slide with stretched image, class img.reveal.stretch' );
3333
});
3434

35+
test( 'Attributes on elements in vertical slides with default element attribute separator', function() {
36+
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' );
37+
});
38+
39+
test( 'Attributes on elements in single slides with default element attribute separator', function() {
40+
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' );
41+
});
42+
3543
} );
3644

3745
Reveal.initialize();

0 commit comments

Comments
 (0)