/
index.html
69 lines (63 loc) · 1.89 KB
/
index.html
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
<!doctype html>
<html>
<head>
<title>Markdown Editor</title>
<link rel="stylesheet" href="reset.css">
<link rel="stylesheet" href="base.css">
<link rel="stylesheet" href="qunit.css">
<link rel="stylesheet" href="../src/markdownEditor.css">
</head>
<body>
<div style="float: left; width: 600px">
<h1>Markdownjs sandbox</h1>
<div class="cols"></div>
<div class="rows"></div>
</div>
<div style="float: left; width: 600px">
<h1 id="qunit-header">Markdown QUnit tests</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">
<div id="test-markdown-container"></div>
</div>
</div>
<script src="qunit.js"></script>
<script src="../lib/showdown.js"></script>
<script src="../lib/jquery.js"></script>
<script src="../src/jquery.markdownEditor.js"></script>
<script>
// visual testing
$('.cols').markdownEditor({
value: '##MarkdownEditor##\n\n' +
'[Link me!](http://github.com/icoloma/markdownEditor "MarkdownEditor")\n\n' +
'Lots of *stuff* to **try**\n\n' +
'Quotes \n> Two things are infinite: the universe and human stupidity; and I am not sure about the the universe.\n\n' +
'Code \n `<div>Your code goes here</div>` \n\n' +
'UnorderedLists \n\n* Item1 \n* Item2\n\n' +
'OrderedLists \n\n1. Item1 \n2. Item2'
});
// qunit test
var opts = {
internals: {}
};
$('#test-markdown-container').markdownEditor(opts);
var i = opts.internals;
var e = $('#test-markdown-container .markdown-editor')[0];
// $('.rows').markdownEditor();
test("history test", function() {
e.value = 'foo';
i.pushHistory();
equal(i.history.length, 2);
e.value = 'bar';
i.popHistory();
equal(e.value, "foo", "popHistory() should have retrieved the previous value" );
i.popHistory();
e.value("xxx");
i.pushHistory();
equal(i.history.length, 1);
});
</script>
</body>
</html>