aboutsummaryrefslogtreecommitdiff
path: root/test/test-markdown-options.html
blob: 7b2a631e775a112b62d6a12e4ba86baa25ba7ddf (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
<!doctype html>
<html lang="en">

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

		<title>reveal.js - Test Markdown Options</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>
					<script type="text/template">
						## Testing Markdown Options

						This "slide" should contain 'smart' quotes.
					</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' },
					// Test loading JS files with query strings
					{ src: '../plugin/markdown/markdown.js?query=string' },
				],
				markdown: {
					smartypants: true
				}
			}).then( function() {

				QUnit.module( 'Markdown' );

				QUnit.test( 'Options are set', function( assert ) {
					assert.strictEqual( marked.defaults.smartypants, true );
				});

				QUnit.test( 'Smart quotes are activated', function( assert ) {
					var text = document.querySelector( '.reveal .slides>section>p' ).textContent;

					assert.strictEqual( /['"]/.test( text ), false );
					assert.strictEqual( /[“”‘’]/.test( text ), true );
				});

			} );

		</script>

	</body>
</html>