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
a4744faa
Commit
a4744faa
authored
Jun 11, 2015
by
Randall Leeds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update add/remove anchors to annotations tests
parent
6a853c12
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
guest-test.coffee
h/static/scripts/annotator/test/guest-test.coffee
+26
-0
No files found.
h/static/scripts/annotator/test/guest-test.coffee
View file @
a4744faa
...
...
@@ -386,3 +386,29 @@ describe 'Guest', ->
assert
.
strictEqual
(
guest
.
anchors
[
0
].
range
,
range
)
assert
.
strictEqual
(
guest
.
anchors
[
0
].
highlights
,
highlights
)
done
()
it
'destroys targets that have been removed from the annotation'
,
(
done
)
->
annotation
=
{}
target
=
{}
highlights
=
[]
guest
=
createGuest
()
guest
.
anchors
=
[{
annotation
,
target
,
highlights
}]
removeHighlights
=
sandbox
.
stub
(
highlighter
,
'removeHighlights'
)
guest
.
setupAnnotation
(
annotation
)
waitForSync
(
annotation
).
then
->
assert
.
equal
(
guest
.
anchors
.
length
,
0
)
assert
.
calledWith
(
removeHighlights
,
highlights
)
done
()
it
'does not reanchor targets that are already anchored'
,
(
done
)
->
guest
=
createGuest
()
annotation
=
target
:
[{
selector
:
"test"
}]
stub
=
sandbox
.
stub
(
anchoring
,
'anchor'
).
returns
(
range
)
guest
.
setupAnnotation
(
annotation
)
waitForSync
(
annotation
).
then
->
delete
annotation
.
$anchors
guest
.
setupAnnotation
(
annotation
)
waitForSync
(
annotation
).
then
->
assert
.
equal
(
guest
.
anchors
.
length
,
1
)
assert
.
calledOnce
(
stub
)
done
()
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