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
41bb7d05
Commit
41bb7d05
authored
Nov 18, 2020
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add additional tests for `describe` being passed invalid ranges
parent
fa1474e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
7 deletions
+34
-7
pdf-test.js
src/annotator/anchoring/test/pdf-test.js
+34
-7
No files found.
src/annotator/anchoring/test/pdf-test.js
View file @
41bb7d05
...
@@ -159,16 +159,43 @@ describe('annotator/anchoring/pdf', function () {
...
@@ -159,16 +159,43 @@ describe('annotator/anchoring/pdf', function () {
});
});
});
});
it
(
'
rejects when text selection spans multiple pages'
,
()
=>
{
it
(
'
throws if range spans multiple pages'
,
async
()
=>
{
viewer
.
pdfViewer
.
setCurrentPage
(
2
,
3
);
viewer
.
pdfViewer
.
setCurrentPage
(
2
,
3
);
const
range
=
findText
(
container
,
'occupied again? NODE A'
);
const
range
=
findText
(
container
,
'occupied again? NODE A'
);
return
pdfAnchoring
.
describe
(
container
,
range
).
catch
(
err
=>
{
await
assert
.
rejects
(
assert
.
equal
(
pdfAnchoring
.
describe
(
container
,
range
),
err
.
message
,
'Selecting across page breaks is not supported'
'Selecting across page breaks is not supported'
);
);
});
});
it
(
'throws if range is outside the text layer'
,
async
()
=>
{
viewer
.
pdfViewer
.
setCurrentPage
(
2
,
3
);
const
range
=
new
Range
();
const
el
=
document
.
createElement
(
'div'
);
el
.
append
(
'foobar'
);
range
.
setStart
(
el
.
firstChild
,
0
);
range
.
setEnd
(
el
.
firstChild
,
6
);
await
assert
.
rejects
(
pdfAnchoring
.
describe
(
container
,
range
),
'Selection is outside page text'
);
});
it
(
'throws if range does not contain any text nodes'
,
async
()
=>
{
viewer
.
pdfViewer
.
setCurrentPage
(
2
,
3
);
const
range
=
new
Range
();
const
el
=
document
.
createElement
(
'div'
);
range
.
setStart
(
el
,
0
);
range
.
setEnd
(
el
,
0
);
await
assert
.
rejects
(
pdfAnchoring
.
describe
(
container
,
range
),
'Selection does not contain text'
);
});
});
});
});
...
...
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