From 19e7b54d27681d12823d0f341d9a39933d8a7213 Mon Sep 17 00:00:00 2001 From: jamesmaa Date: Fri, 25 Oct 2024 12:59:21 -0700 Subject: [PATCH] Test case --- test/data/html/dom-text-scanner.html | 22 ++++++++++++++++++++-- test/dom-text-scanner.test.js | 5 ++++- types/test/dom-text-scanner.d.ts | 1 + 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/test/data/html/dom-text-scanner.html b/test/data/html/dom-text-scanner.html index 540567bd3c..0e072d57fb 100644 --- a/test/data/html/dom-text-scanner.html +++ b/test/data/html/dom-text-scanner.html @@ -12,7 +12,7 @@

DOMTextScanner Tests

Automated test cases for DOMTextScanner. - + + + Stops at word boundary +
+ read +
+
diff --git a/test/dom-text-scanner.test.js b/test/dom-text-scanner.test.js index e204f2a389..f888937195 100644 --- a/test/dom-text-scanner.test.js +++ b/test/dom-text-scanner.test.js @@ -136,6 +136,7 @@ describe('DOMTextScanner seek tests', () => { forcePreserveWhitespace, generateLayoutContent, reversible, + stopAtWordBoundary, expected: { node: expectedNodeSelector, offset: expectedOffset, @@ -152,7 +153,9 @@ describe('DOMTextScanner seek tests', () => { if (node === null || expectedNode === null) { continue; } test(`${testDescription} standard test`, () => { - const scanner = new DOMTextScanner(node, offset, forcePreserveWhitespace, generateLayoutContent); + console.log('stopAtWordBoundary', stopAtWordBoundary); + + const scanner = new DOMTextScanner(node, offset, forcePreserveWhitespace, generateLayoutContent, stopAtWordBoundary); scanner.seek(length); const {node: actualNode1, offset: actualOffset1, content: actualContent1, remainder: actualRemainder1} = scanner; diff --git a/types/test/dom-text-scanner.d.ts b/types/test/dom-text-scanner.d.ts index ebbbab7082..e94a7ff9d7 100644 --- a/types/test/dom-text-scanner.d.ts +++ b/types/test/dom-text-scanner.d.ts @@ -22,6 +22,7 @@ export type TestData = { forcePreserveWhitespace?: boolean; generateLayoutContent?: boolean; reversible?: boolean; + stopAtWordBoundary?: boolean; expected: { node: string; offset: number;