summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-05-06 19:33:17 -0400
committerGitHub <noreply@github.com>2020-05-06 19:33:17 -0400
commitf7df6254d6f71d5331b000dcbd27271bd2c3006f (patch)
tree99ec2aa66349ba07d4379f31ee3be762235249dd /test
parentbb2d9501afc0e406b0dacf5675cd90985238be98 (diff)
Dom text scanner fixes (#505)
* Fix test case * Add test-dom-text-scanner * Ensure that DOMTextScanner._node never becomes null * Add remainder
Diffstat (limited to 'test')
-rw-r--r--test/data/html/test-dom-text-scanner.html2
-rw-r--r--test/test-dom-text-scanner.js6
2 files changed, 5 insertions, 3 deletions
diff --git a/test/data/html/test-dom-text-scanner.html b/test/data/html/test-dom-text-scanner.html
index 6b78570a..dc06eb64 100644
--- a/test/data/html/test-dom-text-scanner.html
+++ b/test/data/html/test-dom-text-scanner.html
@@ -85,7 +85,7 @@
"expected": {
"node": "span:nth-of-type(2)::text",
"offset": 6,
- "content": "小ぢんまり1\n小ぢんまり2"
+ "content": "小ぢんまり1 小ぢんまり2"
}
}'
>
diff --git a/test/test-dom-text-scanner.js b/test/test-dom-text-scanner.js
index 41d6e307..7374ff87 100644
--- a/test/test-dom-text-scanner.js
+++ b/test/test-dom-text-scanner.js
@@ -103,7 +103,8 @@ async function testDomTextScanner(dom, {DOMTextScanner}) {
expected: {
node: expectedNode,
offset: expectedOffset,
- content: expectedContent
+ content: expectedContent,
+ remainder: expectedRemainder
}
} = testDataItem;
@@ -115,10 +116,11 @@ async function testDomTextScanner(dom, {DOMTextScanner}) {
const scanner = new DOMTextScanner(node, offset, forcePreserveWhitespace, generateLayoutContent);
scanner.seek(length);
- const {node: actualNode1, offset: actualOffset1, content: actualContent1} = scanner;
+ const {node: actualNode1, offset: actualOffset1, content: actualContent1, remainder: actualRemainder1} = scanner;
assert.strictEqual(actualContent1, expectedContent);
assert.strictEqual(actualOffset1, expectedOffset);
assert.strictEqual(actualNode1, expectedNode);
+ assert.strictEqual(actualRemainder1, expectedRemainder || 0);
}
// Substring tests