-
-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: update Events/07 test to clarify interpretation of tag end sla…
…shes Enhancements to the `Events/07-self-closing.json` test to better cover and demonstrate the interpretation of tag end slashes (e.g. `/>`) `07-self-closing.json` is replaced with a set of tests 07a to 07h where the input and context are identical except for one isolated change. The outputs can thereby be diffed, showing the effect of the isolated change. Adds test coverage for the `recognizeSelfClosing` option.
- Loading branch information
1 parent
40ac4c4
commit 0c6fcd1
Showing
8 changed files
with
373 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "end slash: void element ending with />", | ||
"input": "<hr / ><p>Hold the line.", | ||
"expected": [ | ||
{ | ||
"event": "opentagname", | ||
"startIndex": 0, | ||
"endIndex": 3, | ||
"data": ["hr"] | ||
}, | ||
{ | ||
"event": "opentag", | ||
"startIndex": 0, | ||
"endIndex": 6, | ||
"data": ["hr", {}, false] | ||
}, | ||
{ | ||
"event": "closetag", | ||
"startIndex": 0, | ||
"endIndex": 6, | ||
"data": ["hr", true] | ||
}, | ||
{ | ||
"event": "opentagname", | ||
"startIndex": 7, | ||
"endIndex": 9, | ||
"data": ["p"] | ||
}, | ||
{ | ||
"event": "opentag", | ||
"startIndex": 7, | ||
"endIndex": 9, | ||
"data": ["p", {}, false] | ||
}, | ||
{ | ||
"event": "text", | ||
"startIndex": 10, | ||
"endIndex": 23, | ||
"data": ["Hold the line."] | ||
}, | ||
{ | ||
"event": "closetag", | ||
"startIndex": 24, | ||
"endIndex": 24, | ||
"data": ["p", true] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "end slash: void element ending with >", | ||
"input": "<hr ><p>Hold the line.", | ||
"expected": [ | ||
{ | ||
"event": "opentagname", | ||
"startIndex": 0, | ||
"endIndex": 3, | ||
"data": ["hr"] | ||
}, | ||
{ | ||
"event": "opentag", | ||
"startIndex": 0, | ||
"endIndex": 6, | ||
"data": ["hr", {}, false] | ||
}, | ||
{ | ||
"event": "closetag", | ||
"startIndex": 0, | ||
"endIndex": 6, | ||
"data": ["hr", true] | ||
}, | ||
{ | ||
"event": "opentagname", | ||
"startIndex": 7, | ||
"endIndex": 9, | ||
"data": ["p"] | ||
}, | ||
{ | ||
"event": "opentag", | ||
"startIndex": 7, | ||
"endIndex": 9, | ||
"data": ["p", {}, false] | ||
}, | ||
{ | ||
"event": "text", | ||
"startIndex": 10, | ||
"endIndex": 23, | ||
"data": ["Hold the line."] | ||
}, | ||
{ | ||
"event": "closetag", | ||
"startIndex": 24, | ||
"endIndex": 24, | ||
"data": ["p", true] | ||
} | ||
] | ||
} |
53 changes: 53 additions & 0 deletions
53
src/__fixtures__/Events/07c-end_slash--void_without--xmlMode.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"name": "end slash: void element ending with >, xmlMode=true", | ||
"input": "<hr ><p>Hold the line.", | ||
"options": { | ||
"parser": { | ||
"xmlMode": true | ||
} | ||
}, | ||
"expected": [ | ||
{ | ||
"event": "opentagname", | ||
"startIndex": 0, | ||
"endIndex": 3, | ||
"data": ["hr"] | ||
}, | ||
{ | ||
"event": "opentag", | ||
"startIndex": 0, | ||
"endIndex": 6, | ||
"data": ["hr", {}, false] | ||
}, | ||
{ | ||
"event": "opentagname", | ||
"startIndex": 7, | ||
"endIndex": 9, | ||
"data": ["p"] | ||
}, | ||
{ | ||
"event": "opentag", | ||
"startIndex": 7, | ||
"endIndex": 9, | ||
"data": ["p", {}, false] | ||
}, | ||
{ | ||
"event": "text", | ||
"startIndex": 10, | ||
"endIndex": 23, | ||
"data": ["Hold the line."] | ||
}, | ||
{ | ||
"event": "closetag", | ||
"startIndex": 24, | ||
"endIndex": 24, | ||
"data": ["p", true] | ||
}, | ||
{ | ||
"event": "closetag", | ||
"startIndex": 24, | ||
"endIndex": 24, | ||
"data": ["hr", true] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "end slash: non-void element ending with />", | ||
"input": "<xx / ><p>Hold the line.", | ||
"expected": [ | ||
{ | ||
"event": "opentagname", | ||
"startIndex": 0, | ||
"endIndex": 3, | ||
"data": ["xx"] | ||
}, | ||
{ | ||
"event": "opentag", | ||
"startIndex": 0, | ||
"endIndex": 6, | ||
"data": ["xx", {}, false] | ||
}, | ||
{ | ||
"event": "opentagname", | ||
"startIndex": 7, | ||
"endIndex": 9, | ||
"data": ["p"] | ||
}, | ||
{ | ||
"event": "opentag", | ||
"startIndex": 7, | ||
"endIndex": 9, | ||
"data": ["p", {}, false] | ||
}, | ||
{ | ||
"event": "text", | ||
"startIndex": 10, | ||
"endIndex": 23, | ||
"data": ["Hold the line."] | ||
}, | ||
{ | ||
"event": "closetag", | ||
"startIndex": 24, | ||
"endIndex": 24, | ||
"data": ["p", true] | ||
}, | ||
{ | ||
"event": "closetag", | ||
"startIndex": 24, | ||
"endIndex": 24, | ||
"data": ["xx", true] | ||
} | ||
] | ||
} |
53 changes: 53 additions & 0 deletions
53
src/__fixtures__/Events/07e-end_slash--non_void--xmlmode.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"name": "end slash: non-void element ending with />, xmlMode=true", | ||
"input": "<xx / ><p>Hold the line.", | ||
"options": { | ||
"parser": { | ||
"xmlMode": true | ||
} | ||
}, | ||
"expected": [ | ||
{ | ||
"event": "opentagname", | ||
"startIndex": 0, | ||
"endIndex": 3, | ||
"data": ["xx"] | ||
}, | ||
{ | ||
"event": "opentag", | ||
"startIndex": 0, | ||
"endIndex": 6, | ||
"data": ["xx", {}, false] | ||
}, | ||
{ | ||
"event": "closetag", | ||
"startIndex": 0, | ||
"endIndex": 6, | ||
"data": ["xx", true] | ||
}, | ||
{ | ||
"event": "opentagname", | ||
"startIndex": 7, | ||
"endIndex": 9, | ||
"data": ["p"] | ||
}, | ||
{ | ||
"event": "opentag", | ||
"startIndex": 7, | ||
"endIndex": 9, | ||
"data": ["p", {}, false] | ||
}, | ||
{ | ||
"event": "text", | ||
"startIndex": 10, | ||
"endIndex": 23, | ||
"data": ["Hold the line."] | ||
}, | ||
{ | ||
"event": "closetag", | ||
"startIndex": 24, | ||
"endIndex": 24, | ||
"data": ["p", true] | ||
} | ||
] | ||
} |
53 changes: 53 additions & 0 deletions
53
src/__fixtures__/Events/07f-end_slash--non_void--recognize_self_closing.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"name": "end slash: non-void element ending with />, recognizeSelfClosing=true", | ||
"input": "<xx / ><p>Hold the line.", | ||
"options": { | ||
"parser": { | ||
"recognizeSelfClosing": true | ||
} | ||
}, | ||
"expected": [ | ||
{ | ||
"event": "opentagname", | ||
"startIndex": 0, | ||
"endIndex": 3, | ||
"data": ["xx"] | ||
}, | ||
{ | ||
"event": "opentag", | ||
"startIndex": 0, | ||
"endIndex": 6, | ||
"data": ["xx", {}, false] | ||
}, | ||
{ | ||
"event": "closetag", | ||
"startIndex": 0, | ||
"endIndex": 6, | ||
"data": ["xx", true] | ||
}, | ||
{ | ||
"event": "opentagname", | ||
"startIndex": 7, | ||
"endIndex": 9, | ||
"data": ["p"] | ||
}, | ||
{ | ||
"event": "opentag", | ||
"startIndex": 7, | ||
"endIndex": 9, | ||
"data": ["p", {}, false] | ||
}, | ||
{ | ||
"event": "text", | ||
"startIndex": 10, | ||
"endIndex": 23, | ||
"data": ["Hold the line."] | ||
}, | ||
{ | ||
"event": "closetag", | ||
"startIndex": 24, | ||
"endIndex": 24, | ||
"data": ["p", true] | ||
} | ||
] | ||
} |
54 changes: 54 additions & 0 deletions
54
src/__fixtures__/Events/07g-end_slash--consumed_by_attrib_value_in_void.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"name": "end slash: as part of attrib value of void element", | ||
"input": "<img src=gif.com/123/><p>Hold the line.", | ||
"expected": [ | ||
{ | ||
"event": "opentagname", | ||
"startIndex": 0, | ||
"endIndex": 4, | ||
"data": ["img"] | ||
}, | ||
{ | ||
"event": "attribute", | ||
"startIndex": 5, | ||
"endIndex": 21, | ||
"data": ["src", "gif.com/123/", null] | ||
}, | ||
{ | ||
"event": "opentag", | ||
"startIndex": 0, | ||
"endIndex": 21, | ||
"data": ["img", {"src": "gif.com/123/"}, false] | ||
}, | ||
{ | ||
"event": "closetag", | ||
"startIndex": 0, | ||
"endIndex": 21, | ||
"data": ["img", true] | ||
}, | ||
{ | ||
"event": "opentagname", | ||
"startIndex": 22, | ||
"endIndex": 24, | ||
"data": ["p"] | ||
}, | ||
{ | ||
"event": "opentag", | ||
"startIndex": 22, | ||
"endIndex": 24, | ||
"data": ["p", {}, false] | ||
}, | ||
{ | ||
"event": "text", | ||
"startIndex": 25, | ||
"endIndex": 38, | ||
"data": ["Hold the line."] | ||
}, | ||
{ | ||
"event": "closetag", | ||
"startIndex": 39, | ||
"endIndex": 39, | ||
"data": ["p", true] | ||
} | ||
] | ||
} |
Oops, something went wrong.