forked from commonmark/commonmark-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtensionsIntegrationTest.java
More file actions
38 lines (31 loc) · 1.25 KB
/
ExtensionsIntegrationTest.java
File metadata and controls
38 lines (31 loc) · 1.25 KB
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
package org.commonmark.integration;
import org.commonmark.parser.Parser;
import org.commonmark.renderer.html.HtmlRenderer;
import org.commonmark.testutil.RenderingTestCase;
import org.junit.Test;
/**
* Tests to ensure all extensions work well together.
*/
public class ExtensionsIntegrationTest extends RenderingTestCase {
protected static final Parser PARSER = Parser.builder()
.extensions(Extensions.ALL_EXTENSIONS)
.build();
protected static final HtmlRenderer RENDERER = HtmlRenderer.builder()
.extensions(Extensions.ALL_EXTENSIONS)
.percentEncodeUrls(true)
.build();
@Test
public void testImageAttributes() {
assertRendering("{height=5 width=6}", "<p><img src=\"/url.png\" alt=\"text\" height=\"5\" width=\"6\" /></p>\n");
}
@Test
public void testTaskListItems() {
assertRendering("- [ ] task to do\n- [x] task done\n",
"<ul>\n<li><input type=\"checkbox\" disabled=\"\"> task to do</li>\n" +
"<li><input type=\"checkbox\" disabled=\"\" checked=\"\"> task done</li>\n</ul>\n");
}
@Override
protected String render(String source) {
return RENDERER.render(PARSER.parse(source));
}
}