diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-05-16 15:24:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-16 15:24:38 -0400 |
commit | 66d048832f2dc30e11e6be4c68beab23c7d8adef (patch) | |
tree | 9cb1d83faacf133f61c3a96156ea6de1541e5233 /test | |
parent | 41ee167dfdfcd794634e0459185a929e814b0493 (diff) |
Sentence termination character mode (#1682)
* Change enableTerminationCharacters to terminationCharacterMode
* Update settings
* Update sentence extraction
* Update tests
* Add tests
Diffstat (limited to 'test')
-rw-r--r-- | test/data/html/test-document1.html | 42 | ||||
-rw-r--r-- | test/test-document-util.js | 5 | ||||
-rw-r--r-- | test/test-options-util.js | 4 |
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 ありがとございます2 ありがとございます3 ありがとございます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 |