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
7881c7bf
Commit
7881c7bf
authored
Jun 16, 2016
by
Alice Wyan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reject annotation anchoring when no quote selector found
parent
1017c930
Changes
2
Hide 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 @
7881c7bf
...
...
@@ -50,6 +50,11 @@ exports.anchor = (root, selectors, options = {}) ->
when
'RangeSelector'
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
maybeAssertQuote
=
(
range
)
->
if
quote
?
.
exact
?
and
range
.
toString
()
!=
quote
.
exact
...
...
h/static/scripts/annotator/test/integration/anchoring-test.js
View file @
7881c7bf
...
...
@@ -99,4 +99,22 @@ describe('anchoring', function () {
],
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