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
370fe800
Commit
370fe800
authored
Jan 28, 2019
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test to check `describe` fails when selection spans multiple pages
parent
fe5a3987
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
fake-pdf-viewer-application.js
src/annotator/anchoring/test/fake-pdf-viewer-application.js
+6
-4
pdf-test.js
src/annotator/anchoring/test/pdf-test.js
+9
-0
No files found.
src/annotator/anchoring/test/fake-pdf-viewer-application.js
View file @
370fe800
...
...
@@ -108,16 +108,18 @@ function createPage(content, rendered) {
/**
* Set the index of the page which is currently visible in the viewport.
*
* The page which is visible will be "rendered" and have a text layer available.
* For other pages, there will only be a placeholder element for the whole page.
* Pages from `index` up to and including `lastRenderedPage` will be
* "rendered" and have a text layer available. Other pages will be "un-rendered"
* with no text layer available, but only a placeholder element for the whole
* page.
*/
FakePDFViewerApplication
.
prototype
.
setCurrentPage
=
function
(
index
)
{
FakePDFViewerApplication
.
prototype
.
setCurrentPage
=
function
(
index
,
lastRenderedPage
=
index
)
{
const
self
=
this
;
this
.
_checkBounds
(
index
);
const
pages
=
this
.
_content
.
map
(
function
(
text
,
idx
)
{
return
createPage
(
text
,
idx
===
index
/* rendered */
);
return
createPage
(
text
,
idx
>=
index
&&
idx
<=
lastRenderedPage
);
});
this
.
_container
.
innerHTML
=
''
;
...
...
src/annotator/anchoring/test/pdf-test.js
View file @
370fe800
...
...
@@ -134,6 +134,15 @@ describe('annotator.anchoring.pdf', function () {
assert
.
equal
(
position
.
end
,
expectedPos
+
quote
.
length
);
});
});
it
(
'rejects when text selection spans multiple pages'
,
()
=>
{
viewer
.
setCurrentPage
(
2
,
3
);
const
range
=
findText
(
container
,
'occupied again? NODE A'
);
return
pdfAnchoring
.
describe
(
container
,
range
).
catch
(
err
=>
{
assert
.
equal
(
err
.
message
,
'selecting across page breaks is not supported'
);
});
});
});
describe
(
'#anchor'
,
function
()
{
...
...
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