Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/markdownit.spec.js')
-rw-r--r--src/tests/markdownit.spec.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/tests/markdownit.spec.js b/src/tests/markdownit.spec.js
new file mode 100644
index 000000000..08d5cb0a9
--- /dev/null
+++ b/src/tests/markdownit.spec.js
@@ -0,0 +1,33 @@
+import markdownit from './../markdownit'
+
+describe('markdownit', () => {
+
+ it('renders task lists', () => {
+ const rendered = markdownit.render('* [ ] task\n* not a task')
+ expect(rendered).toBe(stripIndent(`
+ <ul class="contains-task-list">
+ <li class="task-list-item"><input class="task-list-item-checkbox" disabled="" type="checkbox"> task</li>
+ </ul>
+ <ul>
+ <li>not a task</li>
+ </ul>
+`))
+ })
+
+ it('renders bullet and task lists separately', () => {
+ const rendered = markdownit.render('* not a task\n* [ ] task')
+ expect(rendered).toBe(stripIndent(`
+ <ul>
+ <li>not a task</li>
+ </ul>
+ <ul class="contains-task-list">
+ <li class="task-list-item"><input class="task-list-item-checkbox" disabled="" type="checkbox"> task</li>
+ </ul>
+`))
+ })
+
+})
+
+function stripIndent(content) {
+ return content.replace(/\t/g, '').replace('\n','')
+}