You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@annotator.apache.org by ge...@apache.org on 2020/07/23 13:42:57 UTC

[incubator-annotator] 02/05: Fix document->doc

This is an automated email from the ASF dual-hosted git repository.

gerben pushed a commit to branch tweak-highlighter
in repository https://gitbox.apache.org/repos/asf/incubator-annotator.git

commit 46cb99facfaace607381b8629157e7e83507d28f
Author: Gerben <ge...@treora.com>
AuthorDate: Thu Jul 23 12:24:00 2020 +0200

    Fix document->doc
---
 packages/dom/test/text-quote/describe.test.ts |  4 ++--
 packages/dom/test/text-quote/match.test.ts    | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/packages/dom/test/text-quote/describe.test.ts b/packages/dom/test/text-quote/describe.test.ts
index f962157..5b560ff 100644
--- a/packages/dom/test/text-quote/describe.test.ts
+++ b/packages/dom/test/text-quote/describe.test.ts
@@ -38,7 +38,7 @@ describe('describeTextQuote', () => {
   it('works with custom scope', async () => {
     const { html, range } = testCases['minimal prefix'];
     const doc = domParser.parseFromString(html, 'text/html');
-    const scope = document.createRange();
+    const scope = doc.createRange();
     scope.setStart(evaluateXPath(doc, '//b/text()'), 15);
     scope.setEnd(evaluateXPath(doc, '//b/text()'), 30); // "not to annotate"
     const result = await describeTextQuote(hydrateRange(range, doc), scope);
@@ -53,7 +53,7 @@ describe('describeTextQuote', () => {
   it('strips part of the range outside the scope', async () => {
     const { html, range } = testCases['simple'];
     const doc = domParser.parseFromString(html, 'text/html');
-    const scope = document.createRange();
+    const scope = doc.createRange();
     scope.setStart(evaluateXPath(doc, '//b/text()'), 6);
     scope.setEnd(evaluateXPath(doc, '//b/text()'), 17); // "ipsum dolor"
     const result = await describeTextQuote(hydrateRange(range, doc), scope);
diff --git a/packages/dom/test/text-quote/match.test.ts b/packages/dom/test/text-quote/match.test.ts
index 3148a3f..af6a5d2 100644
--- a/packages/dom/test/text-quote/match.test.ts
+++ b/packages/dom/test/text-quote/match.test.ts
@@ -117,7 +117,7 @@ describe('createTextQuoteSelectorMatcher', () => {
     const doc = domParser.parseFromString(html, 'text/html');
 
     // Use the substring ‘ipsum dolor amet’ as scope.
-    const scope = document.createRange();
+    const scope = doc.createRange();
     scope.setStart(evaluateXPath(doc, '//b/text()'), 6);
     scope.setEnd(evaluateXPath(doc, '//b/text()'), 22);
     await testMatcher(doc, scope, selector, expected);
@@ -128,7 +128,7 @@ describe('createTextQuoteSelectorMatcher', () => {
     const doc = domParser.parseFromString(html, 'text/html');
 
     // Use the substring ‘sum dolor am’ as scope.
-    const scope = document.createRange();
+    const scope = doc.createRange();
     scope.setStart(evaluateXPath(doc, '//i/text()'), 2);
     scope.setEnd(evaluateXPath(doc, '//u/text()'), 2);
     await testMatcher(doc, scope, selector, expected);
@@ -138,7 +138,7 @@ describe('createTextQuoteSelectorMatcher', () => {
     const { html, selector, expected } = testCases['across elements'];
     const doc = domParser.parseFromString(html, 'text/html');
 
-    const scope = document.createRange();
+    const scope = doc.createRange();
     scope.setStart(evaluateXPath(doc, '//b'), 1); // before the <i>
     scope.setEnd(evaluateXPath(doc, '//b'), 4); // before the " yada yada"
     await testMatcher(doc, scope, selector, expected);
@@ -148,7 +148,7 @@ describe('createTextQuoteSelectorMatcher', () => {
     const { html, selector } = testCases['simple'];
     const doc = domParser.parseFromString(html, 'text/html');
 
-    const scope = document.createRange();
+    const scope = doc.createRange();
     await testMatcher(doc, scope, selector, []);
   });
 
@@ -156,7 +156,7 @@ describe('createTextQuoteSelectorMatcher', () => {
     const { html, selector } = testCases['simple'];
     const doc = domParser.parseFromString(html, 'text/html');
 
-    const scope = document.createRange();
+    const scope = doc.createRange();
     scope.setStart(evaluateXPath(doc, '//b/text()'), 0);
     scope.setEnd(evaluateXPath(doc, '//b/text()'), 19);
     await testMatcher(doc, scope, selector, []);
@@ -166,7 +166,7 @@ describe('createTextQuoteSelectorMatcher', () => {
     const { html, selector } = testCases['simple'];
     const doc = domParser.parseFromString(html, 'text/html');
 
-    const scope = document.createRange();
+    const scope = doc.createRange();
     scope.setStart(evaluateXPath(doc, '//b/text()'), 13);
     scope.setEnd(evaluateXPath(doc, '//b/text()'), 32);
     await testMatcher(doc, scope, selector, []);