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
bcb55d44
Commit
bcb55d44
authored
Jun 17, 2016
by
Robert Knight
Committed by
GitHub
Jun 17, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3475 from hypothesis/wyan/bugfix-whole-page-annotation-highlights
Bugfix: whole page annotation highlights
parents
61974f4e
7881c7bf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
html.coffee
h/static/scripts/annotator/anchoring/html.coffee
+5
-0
anchoring-test.js
...atic/scripts/annotator/test/integration/anchoring-test.js
+18
-0
No files found.
h/static/scripts/annotator/anchoring/html.coffee
View file @
bcb55d44
...
@@ -50,6 +50,11 @@ exports.anchor = (root, selectors, options = {}) ->
...
@@ -50,6 +50,11 @@ exports.anchor = (root, selectors, options = {}) ->
when
'RangeSelector'
when
'RangeSelector'
range
=
selector
range
=
selector
# Assert that there is a quote selector, since otherwise we cannot validate
# the rest of the annotation's selectors.
if
not
quote
?
return
Promise
.
reject
(
new
Error
(
'quote selector not found'
))
# Assert the quote matches the stored quote, if applicable
# Assert the quote matches the stored quote, if applicable
maybeAssertQuote
=
(
range
)
->
maybeAssertQuote
=
(
range
)
->
if
quote
?
.
exact
?
and
range
.
toString
()
!=
quote
.
exact
if
quote
?
.
exact
?
and
range
.
toString
()
!=
quote
.
exact
...
...
h/static/scripts/annotator/test/integration/anchoring-test.js
View file @
bcb55d44
...
@@ -99,4 +99,22 @@ describe('anchoring', function () {
...
@@ -99,4 +99,22 @@ describe('anchoring', function () {
],
],
expectFail
:
true
,
expectFail
:
true
,
}]);
}]);
unroll
(
'should silently fail when an annotation does not have a quote selector'
,
function
(
testCase
)
{
var
annotation
=
testCase
.
annotation
;
var
anchored
=
guest
.
anchor
(
annotation
);
return
anchored
.
then
(
function
(
result
)
{
assert
.
deepEqual
(
result
,
[]);
});
},
[{
annotation
:
[{
target
:
[{
selector
:
[{
type
:
'FragmentSelector'
,
value
:
't=30,60'
}]
}]
}],
}]);
});
});
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