aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-09 23:10:55 -0500
committerGitHub <noreply@github.com>2021-01-09 23:10:55 -0500
commit083da93142ec6302021ee1c29428121b54fc9e68 (patch)
treec07c7e3ae808682e127603303f4698056204abd7 /test
parentda1e1e5c5b4dc20cc6aa46b51c55a496d094ed5c (diff)
Refactor sentence parsing (#1215)
* Rename sentenceExtent with sentenceScanExtent * Update TextScanner.setOptions * Change function argument order * Rename quote map variables * Fix edge case quote handling * Update terminator maps to support character inclusion
Diffstat (limited to 'test')
-rw-r--r--test/data/html/test-document1.html18
-rw-r--r--test/test-document-util.js6
2 files changed, 12 insertions, 12 deletions
diff --git a/test/data/html/test-document1.html b/test/data/html/test-document1.html
index 37dbb017..3b702a86 100644
--- a/test/data/html/test-document1.html
+++ b/test/data/html/test-document1.html
@@ -21,7 +21,7 @@
data-end-node-selector="span"
data-end-offset="0"
data-result-type="TextSourceRange",
- data-sentence-extent="100"
+ data-sentence-scan-extent="100"
data-sentence="真白「心配してくださって、ありがとございます」"
>
<span>真白「心配してくださって、ありがとございます」</span>
@@ -37,7 +37,7 @@
data-end-node-selector="span"
data-end-offset="5"
data-result-type="TextSourceRange",
- data-sentence-extent="100"
+ data-sentence-scan-extent="100"
data-sentence="心配してくださって、ありがとございます"
>
<span>真白「心配してくださって、ありがとございます」</span>
@@ -53,7 +53,7 @@
data-end-node-selector="span"
data-end-offset="16"
data-result-type="TextSourceRange",
- data-sentence-extent="100"
+ data-sentence-scan-extent="100"
data-sentence="心配して「くださって」、ありがと「ございます」"
>
<span>真白「心配して「くださって」、ありがと「ございます」」</span>
@@ -69,7 +69,7 @@
data-end-node-selector="span"
data-end-offset="4"
data-result-type="TextSourceRange",
- data-sentence-extent="100"
+ data-sentence-scan-extent="100"
data-sentence="ありがとございます。"
>
<span>ありがとございます。ありがとございます。</span>
@@ -85,7 +85,7 @@
data-end-node-selector="span"
data-end-offset="14"
data-result-type="TextSourceRange",
- data-sentence-extent="100"
+ data-sentence-scan-extent="100"
data-sentence="ありがとございます。"
>
<span>ありがとございます。ありがとございます。</span>
@@ -101,7 +101,7 @@
data-end-node-selector="input"
data-end-offset="0"
data-result-type="TextSourceRange",
- data-sentence-extent="100"
+ data-sentence-scan-extent="100"
data-sentence="真白「心配してくださって、ありがとございます」"
data-has-imposter="true"
>
@@ -118,7 +118,7 @@
data-end-node-selector="textarea"
data-end-offset="0"
data-result-type="TextSourceRange",
- data-sentence-extent="100"
+ data-sentence-scan-extent="100"
data-sentence="真白「心配してくださって、ありがとございます」"
data-has-imposter="true"
>
@@ -135,7 +135,7 @@
data-end-node-selector="button"
data-end-offset="0"
data-result-type="TextSourceElement",
- data-sentence-extent="100"
+ data-sentence-scan-extent="100"
data-sentence="よみちゃん"
>
<button style="width: 100%; box-sizing: border-box; font-family: inherit; font-size: inherit; border: 1px solid #d8d8d8; background-color: #f0f0f0; padding: 0.2em;">よみちゃん</button>
@@ -151,7 +151,7 @@
data-end-node-selector="img"
data-end-offset="0"
data-result-type="TextSourceElement"
- data-sentence-extent="100"
+ data-sentence-scan-extent="100"
data-sentence="よみちゃん"
>
<img src="data:image/gif;base64,R0lGODdhBwAHAIABAAAAAP///ywAAAAABwAHAAACDIRvEaC32FpCbEkKCgA7" alt="よみちゃん" title="よみちゃん" style="width: 70px; height: 70px; image-rendering: crisp-edges; image-rendering: pixelated; display: block;" />
diff --git a/test/test-document-util.js b/test/test-document-util.js
index 56368f0b..09f0c5e7 100644
--- a/test/test-document-util.js
+++ b/test/test-document-util.js
@@ -127,7 +127,7 @@ async function testDocumentTextScanningFunctions(dom, {DocumentUtil, TextSourceR
endNodeSelector,
endOffset,
resultType,
- sentenceExtent,
+ sentenceScanExtent,
sentence,
hasImposter
} = testElement.dataset;
@@ -139,7 +139,7 @@ async function testDocumentTextScanningFunctions(dom, {DocumentUtil, TextSourceR
startOffset = parseInt(startOffset, 10);
endOffset = parseInt(endOffset, 10);
- sentenceExtent = parseInt(sentenceExtent, 10);
+ sentenceScanExtent = parseInt(sentenceScanExtent, 10);
assert.notStrictEqual(elementFromPointValue, null);
assert.notStrictEqual(caretRangeFromPointValue, null);
@@ -182,7 +182,7 @@ async function testDocumentTextScanningFunctions(dom, {DocumentUtil, TextSourceR
if (source === null) { continue; }
// Test docSentenceExtract
- const sentenceActual = documentUtil.extractSentence(source, sentenceExtent, false).text;
+ const sentenceActual = documentUtil.extractSentence(source, false, sentenceScanExtent).text;
assert.strictEqual(sentenceActual, sentence);
// Clean