aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/data/html/test-document1.html42
-rw-r--r--test/test-document-util.js5
-rw-r--r--test/test-options-util.js4
3 files changed, 48 insertions, 3 deletions
diff --git a/test/data/html/test-document1.html b/test/data/html/test-document1.html
index af38540f..78d862c4 100644
--- a/test/data/html/test-document1.html
+++ b/test/data/html/test-document1.html
@@ -159,6 +159,48 @@
<div
class="test"
+ data-test-type="scan"
+ data-element-from-point-selector="span:nth-of-type(3)"
+ data-caret-range-from-point-selector="span:nth-of-type(3)"
+ data-start-node-selector="span:nth-of-type(3)"
+ data-start-offset="0"
+ data-end-node-selector="span:nth-of-type(3)"
+ data-end-offset="0"
+ data-result-type="TextSourceRange"
+ data-sentence-scan-extent="22"
+ data-sentence="ありがとございます3"
+ data-terminate-at-newlines="true"
+ >
+<span>ありがとございます1</span>
+<span>ありがとございます2</span>
+<span>ありがとございます3</span>
+<span>ありがとございます4</span>
+<span>ありがとございます5</span>
+ </div>
+
+ <div
+ class="test"
+ data-test-type="scan"
+ data-element-from-point-selector="span:nth-of-type(3)"
+ data-caret-range-from-point-selector="span:nth-of-type(3)"
+ data-start-node-selector="span:nth-of-type(3)"
+ data-start-offset="0"
+ data-end-node-selector="span:nth-of-type(3)"
+ data-end-offset="0"
+ data-result-type="TextSourceRange"
+ data-sentence-scan-extent="22"
+ data-sentence="ありがとございます1&#10;ありがとございます2&#10;ありがとございます3&#10;ありがとございます4"
+ data-terminate-at-newlines="false"
+ >
+<span>ありがとございます1</span>
+<span>ありがとございます2</span>
+<span>ありがとございます3</span>
+<span>ありがとございます4</span>
+<span>ありがとございます5</span>
+ </div>
+
+ <div
+ class="test"
data-test-type="text-source-range-seek"
data-seek-node-selector="span:nth-of-type(1)"
data-seek-node-is-text="true"
diff --git a/test/test-document-util.js b/test/test-document-util.js
index 52fabf97..e5966034 100644
--- a/test/test-document-util.js
+++ b/test/test-document-util.js
@@ -129,7 +129,8 @@ async function testDocumentTextScanningFunctions(dom, {DocumentUtil, TextSourceR
resultType,
sentenceScanExtent,
sentence,
- hasImposter
+ hasImposter,
+ terminateAtNewlines
} = testElement.dataset;
const elementFromPointValue = querySelectorChildOrSelf(testElement, elementFromPointSelector);
@@ -140,6 +141,7 @@ async function testDocumentTextScanningFunctions(dom, {DocumentUtil, TextSourceR
startOffset = parseInt(startOffset, 10);
endOffset = parseInt(endOffset, 10);
sentenceScanExtent = parseInt(sentenceScanExtent, 10);
+ terminateAtNewlines = (terminateAtNewlines !== 'false');
assert.notStrictEqual(elementFromPointValue, null);
assert.notStrictEqual(caretRangeFromPointValue, null);
@@ -200,6 +202,7 @@ async function testDocumentTextScanningFunctions(dom, {DocumentUtil, TextSourceR
source,
false,
sentenceScanExtent,
+ terminateAtNewlines,
terminatorMap,
forwardQuoteMap,
backwardQuoteMap
diff --git a/test/test-options-util.js b/test/test-options-util.js
index 07b41635..8b65f134 100644
--- a/test/test-options-util.js
+++ b/test/test-options-util.js
@@ -438,7 +438,7 @@ function createProfileOptionsUpdatedTestData1() {
},
sentenceParsing: {
scanExtent: 200,
- enableTerminationCharacters: true,
+ terminationCharacterMode: 'custom',
terminationCharacters: [
{enabled: true, character1: '「', character2: '」', includeCharacterAtStart: false, includeCharacterAtEnd: false},
{enabled: true, character1: '『', character2: '』', includeCharacterAtStart: false, includeCharacterAtEnd: false},
@@ -576,7 +576,7 @@ function createOptionsUpdatedTestData1() {
}
],
profileCurrent: 0,
- version: 11,
+ version: 12,
global: {
database: {
prefixWildcardsSupported: false