aboutsummaryrefslogtreecommitdiff
path: root/test/test-markdown-slide-attributes.html
blob: 274a87fe4491c6753ebf0a50e59177d37d9464b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<!doctype html>
<html lang="en">

	<head>
		<meta charset="utf-8">

		<title>reveal.js - Test Markdown Attributes</title>

		<link rel="stylesheet" href="../dist/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 data-markdown="example.md" data-separator="^\n\n\n" data-separator-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-separator-vertical="^\n\n"
									data-separator-notes="^Note:"
									data-attributes="--\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>

				<section 	data-markdown data-separator="^\n\n\n"
									data-separator-vertical="^\n\n"
									data-separator-notes="^Note:"
									data-charset="utf-8">
					<script type="text/template">
						# Test attributes in Markdown with default separator
						## Slide 1 Def



						## Slide 2 Def
						<!-- .slide: id="slide2def" data-transition="concave" data-background="#A7C66B" -->


						## Slide 2.1 Def
						<!-- .slide: data-background="#f70000" data-transition="page" -->


						## Slide 2.2 Def
						[Link to Slide2](#/slide2def)



						## Slide 3 Def
						<!-- .slide: data-transition="concave" data-background="#C7916B" -->



						## Slide 4
					</script>
				</section>

				<section data-markdown>
					<script type="text/template">
						<!-- .slide: data-background="#ff0000" -->
						## Hello world
					</script>
				</section>

				<section data-markdown>
					<script type="text/template">
						## Hello world
						<!-- .slide: data-background="#ff0000" -->
					</script>
				</section>

				<section data-markdown>
					<script type="text/template">
						## Hello world

						Test
						<!-- .slide: data-background="#ff0000" -->

						More Test
					</script>
				</section>

			</div>

		</div>

		<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, 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>