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
86980390
Commit
86980390
authored
Feb 03, 2015
by
Aron Carroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add stubs for the Annotator.Guest tests
parent
7b82c713
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
2 deletions
+58
-2
guest-test.coffee
tests/js/guest-test.coffee
+58
-2
No files found.
tests/js/guest-test.coffee
View file @
86980390
...
...
@@ -2,13 +2,69 @@ assert = chai.assert
sinon
.
assert
.
expose
(
assert
,
prefix
:
''
)
describe
'Annotator.Guest'
,
->
sandbox
=
sinon
.
sandbox
.
create
()
fakeCFBridge
=
null
createGuest
=
(
options
)
->
element
=
document
.
createElement
(
'div'
)
return
new
Annotator
.
Guest
(
element
,
options
||
{})
# Silence Annotator's sassy backchat
before
->
sinon
.
stub
(
console
,
'log'
)
after
->
console
.
log
.
restore
()
beforeEach
->
sandbox
.
stub
(
console
,
'log'
)
afterEach
->
sandbox
.
restore
()
describe
'setting up the bridge'
,
->
beforeEach
->
fakeCFBridge
=
onConnect
:
sandbox
.
stub
()
on
:
sandbox
.
stub
()
sinon
.
stub
(
Annotator
.
Plugin
,
'Bridge'
).
returns
bridge
:
fakeCFBridge
it
'sets the scope for the cross frame bridge'
,
->
guest
=
createGuest
()
options
=
Annotator
.
Plugin
.
Bridge
.
lastCall
.
args
[
1
]
assert
.
equal
(
options
.
bridgeOptions
.
scope
,
'annotator:bridge'
)
it
'provides an event bus for the annotation sync module'
it
'provides a formatter for the annotation sync module'
it
'publishes the "panelReady event when a connection is established'
describe
'the event bus .on method'
,
->
it
'proxies the event into the annotator event system'
describe
'the event bus .emit method'
,
->
it
'calls deleteAnnotations when an annotationDeleted event is recieved'
it
'does not proxy the deleteAnnotations event'
it
'calls loadAnnotations when an loadAnnotations event is recieved'
it
'does not proxy the loadAnnotations event'
it
'proxies all other events into the annotator event system'
describe
'the formatter'
,
->
it
'applies a "uri" property to the formatted object'
it
'copies the properties from the provided annotation'
it
'strips the "anchors" property'
it
'clones the document.title array if present'
describe
'annotation UI events'
,
->
describe
'on "onEditorHide" event'
,
->
it
'hides the editor'
describe
'on "onEditorSubmit" event'
,
->
it
'sumbits the editor'
describe
'on "focusAnnotations" event'
,
->
it
'focuses any annotations with a matching tag'
it
'unfocuses any annotations without a matching tag'
describe
'on "scrollToAnnotation" event'
,
->
it
'scrolls to the highlight with the matching tag'
describe
'on "getDocumentInfo" event'
,
->
it
'calls the callback with the href and pdf metadata'
it
'calls the callback with the href and document metadata if pdf check fails'
it
'notifies the channel that the return value is async'
describe
'on "setTool" event'
,
->
it
'updates the .tool property'
it
'publishes the "setTool" event'
describe
'on "setVisibleHighlights" event'
,
->
it
'publishes the "setVisibleHighlights" event'
describe
'onAdderMouseUp'
,
->
it
'it prevents the default browser action when triggered'
,
()
->
...
...
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