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
9b9f56c9
Commit
9b9f56c9
authored
Jan 10, 2017
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add additional tests for failing position and range selectors
parent
27f04b76
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
html-test.js
h/static/scripts/annotator/anchoring/test/html-test.js
+31
-0
No files found.
h/static/scripts/annotator/anchoring/test/html-test.js
View file @
9b9f56c9
...
@@ -192,6 +192,11 @@ describe('HTML anchoring', function () {
...
@@ -192,6 +192,11 @@ describe('HTML anchoring', function () {
},
testCases
);
},
testCases
);
describe
(
'When anchoring fails'
,
function
()
{
describe
(
'When anchoring fails'
,
function
()
{
var
validQuoteSelector
=
{
type
:
'TextQuoteSelector'
,
exact
:
'Lorem ipsum'
,
};
it
(
'throws an error if anchoring using a quote fails'
,
function
()
{
it
(
'throws an error if anchoring using a quote fails'
,
function
()
{
var
quoteSelector
=
{
var
quoteSelector
=
{
type
:
'TextQuoteSelector'
,
type
:
'TextQuoteSelector'
,
...
@@ -202,6 +207,32 @@ describe('HTML anchoring', function () {
...
@@ -202,6 +207,32 @@ describe('HTML anchoring', function () {
assert
.
equal
(
result
.
error
.
message
,
'Quote not found'
);
assert
.
equal
(
result
.
error
.
message
,
'Quote not found'
);
});
});
});
});
it
(
'does not throw an error if anchoring using a position fails'
,
function
()
{
var
positionSelector
=
{
type
:
'TextPositionSelector'
,
start
:
1000
,
end
:
1010
,
};
// Providing an annotation has quote selector that anchors, a position
// selector which fails to anchor should be ignored.
return
html
.
anchor
(
container
,
[
positionSelector
,
validQuoteSelector
]);
});
it
(
'does not throw an error if anchoring using a range fails'
,
function
()
{
var
rangeSelector
=
{
type
:
'RangeSelector'
,
startContainer
:
'/main'
,
startOffset
:
1
,
endContainer
:
'/main'
,
endOffset
:
5
,
};
// Providing an annotation has quote selector that anchors, a range
// selector which fails to anchor should be ignored.
return
html
.
anchor
(
container
,
[
rangeSelector
,
validQuoteSelector
]);
});
});
});
describe
(
'Web page baselines'
,
function
()
{
describe
(
'Web page baselines'
,
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