Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
772a73c8
Commit
772a73c8
authored
Dec 01, 2020
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove dom-anchor-text-quote dependency in pdf-test.js
parent
2a1e14c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
pdf-test.js
src/annotator/anchoring/test/pdf-test.js
+11
-4
No files found.
src/annotator/anchoring/test/pdf-test.js
View file @
772a73c8
import
*
as
domAnchorTextQuote
from
'dom-anchor-text-quote'
;
import
*
as
pdfAnchoring
from
'../pdf'
;
import
{
TextRange
}
from
'../text-range'
;
import
FakePDFViewerApplication
from
'./fake-pdf-viewer-application'
;
...
...
@@ -12,7 +11,11 @@ import FakePDFViewerApplication from './fake-pdf-viewer-application';
* @return {Range}
*/
function
findText
(
container
,
text
)
{
return
domAnchorTextQuote
.
toRange
(
container
,
{
exact
:
text
});
const
pos
=
container
.
textContent
.
indexOf
(
text
);
if
(
pos
<
0
)
{
throw
new
Error
(
'Text not found'
);
}
return
TextRange
.
fromOffsets
(
container
,
pos
,
pos
+
text
.
length
).
toRange
();
}
function
delay
(
ms
)
{
...
...
@@ -161,7 +164,11 @@ describe('annotator/anchoring/pdf', function () {
it
(
'throws if range spans multiple pages'
,
async
()
=>
{
viewer
.
pdfViewer
.
setCurrentPage
(
2
,
3
);
const
range
=
findText
(
container
,
'occupied again? NODE A'
);
const
firstPageRange
=
findText
(
container
,
'occupied again?'
);
const
secondPageRange
=
findText
(
container
,
'NODE A'
);
const
range
=
new
Range
();
range
.
setStart
(
firstPageRange
.
startContainer
,
firstPageRange
.
startOffset
);
range
.
setEnd
(
secondPageRange
.
startContainer
,
secondPageRange
.
endOffset
);
await
assert
.
rejects
(
pdfAnchoring
.
describe
(
container
,
range
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment