Add ability to provide text directly in test file

This commit is contained in:
Dimitry Ivanov 2018-08-31 11:55:33 +03:00
parent 1d5cd8cfc0
commit 323ac35bb2
7 changed files with 59 additions and 51 deletions

View File

@ -223,7 +223,16 @@ abstract class TestDataReader {
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
final JsonObject object = array.get(i).getAsJsonObject(); // if element is a string (or a json primitive) let's just add a text node
// right away, this way we will not have to provide text with `text: "my-text"`
// (we still can though)
final JsonElement jsonElement = array.get(i);
if (jsonElement.isJsonPrimitive()) {
testNodes.add(new TestNode.Text(parent, jsonElement.getAsString()));
continue;
}
final JsonObject object = jsonElement.getAsJsonObject();
String name = null; String name = null;
Map<String, String> attributes = new HashMap<>(0); Map<String, String> attributes = new HashMap<>(0);

View File

@ -3,13 +3,13 @@ input: |-
output: output:
- b: - b:
- text: "bold " - "bold "
- i: - i:
- text: "bold italic " - "bold italic "
- s: - s:
- text: "bold italic strike " - "bold italic strike "
- code: "bold italic strike code" - code: "bold italic strike code"
- text: " bold italic strike" - " bold italic strike"
- text: " bold italic" - " bold italic"
- text: " bold" - " bold"
- text: " normal" - " normal"

View File

@ -11,13 +11,13 @@ config:
html-allow-non-closed-tags: false html-allow-non-closed-tags: false
output: output:
- text: "Here is some " - "Here is some "
- a: "link" - a: "link"
href: "https://my.href" href: "https://my.href"
- text: " " - " "
- b: - b:
- text: "bold " - "bold "
- i: "bold italic" #equals to: `- i: - text: "bold italic"` - i: "bold italic" #equals to: `- i: - text: "bold italic"`
- text: " bold" - " bold"
- text: " normal" - " normal"

View File

@ -10,10 +10,9 @@ config:
output: output:
- i: - i:
- text: "italic " - "italic "
- b: - b:
- text: "bold italic " - "bold italic "
- u: - u:
- text: "underline bold italic " - "underline bold italic "
- s: - s: "strike underline bold italic"
- text: "strike underline bold italic"

View File

@ -7,6 +7,6 @@ config:
use-html: true use-html: true
output: output:
- text: "no italic here " - "no italic here "
- b: "bold yeah" - b: "bold yeah"
- text: " no underline" - " no underline"

View File

@ -32,74 +32,74 @@ config:
output: output:
- h1: "html" - h1: "html"
- text: "\n" - "\n"
- h2: "emphasis" - h2: "emphasis"
- text: "\n" - "\n"
- i: "i" - i: "i"
- i: "em" - i: "em"
- i: "cite" - i: "cite"
- i: "dfn" - i: "dfn"
- text: "\n" - "\n"
- h2: "strong-emphasis" - h2: "strong-emphasis"
- text: "\n" - "\n"
- b: "b" - b: "b"
- b: "strong" - b: "strong"
- text: "\n" - "\n"
- h2: "super-script" - h2: "super-script"
- text: "\n" - "\n"
- sup: "sup" - sup: "sup"
- text: "\n" - "\n"
- h2: "sub-script" - h2: "sub-script"
- text: "\n" - "\n"
- sub: "sub" - sub: "sub"
- text: "\n" - "\n"
- h2: "underline" - h2: "underline"
- text: "\n" - "\n"
- u: "u" - u: "u"
- u: "ins" - u: "ins"
- text: "\n" - "\n"
- h2: "strike" - h2: "strike"
- text: "\n" - "\n"
- s: "s" - s: "s"
- s: "del" - s: "del"
- text: "\n" - "\n"
- h2: "link" - h2: "link"
- text: "\n" - "\n"
- a: "a" - a: "a"
href: "a://href" href: "a://href"
- text: "\n" - "\n"
- h2: "unordered-list" - h2: "unordered-list"
- text: "\n" - "\n"
- ul: "ul1" - ul: "ul1"
level: 0 level: 0
- text: "\n" - "\n"
- ul: "ul2" - ul: "ul2"
level: 0 level: 0
- text: "\n" - "\n"
- h2: "ordered-list" - h2: "ordered-list"
- text: "\n" - "\n"
- ol: "ol1" - ol: "ol1"
start: 1 start: 1
- text: "\n" - "\n"
- ol: "ol2" - ol: "ol2"
start: 2 start: 2
- text: "\n" - "\n"
- h2: "image" - h2: "image"
- text: "\n" - "\n"
- img: "img" - img: "img"
src: "img://src" src: "img://src"
imageSize: null imageSize: null
replacementTextIsLink: false replacementTextIsLink: false
- text: "\n" - "\n"
- h2: "blockquote" - h2: "blockquote"
- text: "\n" - "\n"
- blockquote: "blockquote" - blockquote: "blockquote"
- text: "\n" - "\n"
- h3: "3" - h3: "3"
- text: "\n" - "\n"
- h4: "4" - h4: "4"
- text: "\n" - "\n"
- h5: "5" - h5: "5"
- text: "\n" - "\n"
- h6: "6" - h6: "6"

View File

@ -5,8 +5,8 @@ input: |-
output: output:
- blockquote: - blockquote:
- text: "First\n\n" - "First\n\n"
- blockquote: - blockquote:
- text: "Second\n\n" - "Second\n\n"
- blockquote: - blockquote:
- text: "Third" - "Third"