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
376da9f8
Commit
376da9f8
authored
May 09, 2017
by
Juan Corona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove `Annotator` from the relevant tests
parent
a5a8fdc0
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
35 deletions
+45
-35
cross-frame-test.coffee
src/annotator/plugin/test/cross-frame-test.coffee
+25
-9
guest-test.coffee
src/annotator/test/guest-test.coffee
+9
-8
host-test.coffee
src/annotator/test/host-test.coffee
+4
-8
anchoring-test.js
src/annotator/test/integration/anchoring-test.js
+3
-4
sidebar-test.coffee
src/annotator/test/sidebar-test.coffee
+4
-6
No files found.
src/annotator/plugin/test/cross-frame-test.coffee
View file @
376da9f8
CrossFrame
=
require
(
'../cross-frame'
)
proxyquire
=
require
(
'proxyquire'
)
Plugin
=
require
(
'../../plugin'
)
CrossFrame
=
null
describe
'Annotator.Plugin.CrossFrame'
,
->
fakeDiscovery
=
null
fakeBridge
=
null
fakeAnnotationSync
=
null
proxyDiscovery
=
null
proxyBridge
=
null
proxyAnnotationSync
=
null
sandbox
=
sinon
.
sandbox
.
create
()
createCrossFrame
=
(
options
)
->
...
...
@@ -28,9 +36,17 @@ describe 'Annotator.Plugin.CrossFrame', ->
fakeAnnotationSync
=
sync
:
sandbox
.
stub
()
CrossFrame
.
AnnotationSync
=
sandbox
.
stub
().
returns
(
fakeAnnotationSync
)
CrossFrame
.
Discovery
=
sandbox
.
stub
().
returns
(
fakeDiscovery
)
CrossFrame
.
Bridge
=
sandbox
.
stub
().
returns
(
fakeBridge
)
proxyAnnotationSync
=
sandbox
.
stub
().
returns
(
fakeAnnotationSync
)
proxyDiscovery
=
sandbox
.
stub
().
returns
(
fakeDiscovery
)
proxyBridge
=
sandbox
.
stub
().
returns
(
fakeBridge
)
CrossFrame
=
proxyquire
(
'../cross-frame'
,
{
'../plugin'
:
Plugin
,
'../annotation-sync'
:
proxyAnnotationSync
,
'../../shared/bridge'
:
proxyBridge
,
'../../shared/discovery'
:
proxyDiscovery
})
afterEach
->
sandbox
.
restore
()
...
...
@@ -38,23 +54,23 @@ describe 'Annotator.Plugin.CrossFrame', ->
describe
'CrossFrame constructor'
,
->
it
'instantiates the Discovery component'
,
->
createCrossFrame
()
assert
.
calledWith
(
CrossFrame
.
Discovery
,
window
)
assert
.
calledWith
(
proxy
Discovery
,
window
)
it
'passes the options along to the bridge'
,
->
createCrossFrame
(
server
:
true
)
assert
.
calledWith
(
CrossFrame
.
Discovery
,
window
,
server
:
true
)
assert
.
calledWith
(
proxy
Discovery
,
window
,
server
:
true
)
it
'instantiates the CrossFrame component'
,
->
createCrossFrame
()
assert
.
calledWith
(
CrossFrame
.
Discovery
)
assert
.
calledWith
(
proxy
Discovery
)
it
'instantiates the AnnotationSync component'
,
->
createCrossFrame
()
assert
.
called
(
CrossFrame
.
AnnotationSync
)
assert
.
called
(
proxy
AnnotationSync
)
it
'passes along options to AnnotationSync'
,
->
createCrossFrame
()
assert
.
calledWith
(
CrossFrame
.
AnnotationSync
,
fakeBridge
,
{
assert
.
calledWith
(
proxy
AnnotationSync
,
fakeBridge
,
{
on
:
sinon
.
match
.
func
emit
:
sinon
.
match
.
func
})
...
...
src/annotator/test/guest-test.coffee
View file @
376da9f8
Annotator
=
require
(
'annotator'
)
proxyquire
=
require
(
'proxyquire'
)
adder
=
require
(
'../adder'
)
Observable
=
require
(
'../util/observable'
).
Observable
$
=
Annotator
.
$
Annotator
[
'@noCallThru'
]
=
true
;
Delegator
=
require
(
'../delegator'
)
$
=
require
(
'jquery'
)
Delegator
[
'@noCallThru'
]
=
true
Guest
=
null
anchoring
=
{}
...
...
@@ -37,10 +37,12 @@ describe 'Guest', ->
sandbox
=
sinon
.
sandbox
.
create
()
CrossFrame
=
null
fakeCrossFrame
=
null
guestOptions
=
{
pluginClasses
:
{}}
createGuest
=
(
options
)
->
createGuest
=
(
options
=
{})
->
options
=
Object
.
assign
({},
guestOptions
,
options
)
element
=
document
.
createElement
(
'div'
)
return
new
Guest
(
element
,
options
||
{}
)
return
new
Guest
(
element
,
options
)
beforeEach
->
FakeAdder
::
instance
=
null
...
...
@@ -60,7 +62,7 @@ describe 'Guest', ->
selections
=
obs
return
()
->
)
'
annotator'
:
Annot
ator
,
'
./delegator'
:
Deleg
ator
,
'raf'
:
raf
,
'scroll-into-view'
:
scrollIntoView
,
})
...
...
@@ -73,11 +75,10 @@ describe 'Guest', ->
CrossFrame
=
sandbox
.
stub
()
CrossFrame
.
returns
(
fakeCrossFrame
)
Annotator
.
Plugin
.
CrossFrame
=
CrossFrame
guestOptions
.
pluginClasses
[
'CrossFrame'
]
=
CrossFrame
afterEach
->
sandbox
.
restore
()
delete
Annotator
.
Plugin
.
CrossFrame
describe
'cross frame'
,
->
...
...
src/annotator/test/host-test.coffee
View file @
376da9f8
Annotator
=
require
(
'annotator'
)
proxyquire
=
require
(
'proxyquire'
)
Host
=
proxyquire
(
'../host'
,
{
'annotator'
:
Annotator
,
})
Host
=
proxyquire
(
'../host'
,
{})
describe
'Host'
,
->
sandbox
=
sinon
.
sandbox
.
create
()
CrossFrame
=
null
fakeCrossFrame
=
null
hostOptions
=
{
pluginClasses
:
{}}
createHost
=
(
options
=
{},
element
=
null
)
->
options
=
Object
.
assign
({
app
:
'/base/annotator/test/empty.html'
},
options
)
options
=
Object
.
assign
({
app
:
'/base/annotator/test/empty.html'
},
hostOptions
,
options
)
if
!
element
element
=
document
.
createElement
(
'div'
)
return
new
Host
(
element
,
options
)
...
...
@@ -27,11 +24,10 @@ describe 'Host', ->
CrossFrame
=
sandbox
.
stub
()
CrossFrame
.
returns
(
fakeCrossFrame
)
Annotator
.
Plugin
.
CrossFrame
=
CrossFrame
hostOptions
.
pluginClasses
[
'CrossFrame'
]
=
CrossFrame
afterEach
->
sandbox
.
restore
()
delete
Annotator
.
Plugin
.
CrossFrame
describe
'widget visibility'
,
->
it
'starts hidden'
,
->
...
...
src/annotator/test/integration/anchoring-test.js
View file @
376da9f8
...
...
@@ -3,8 +3,6 @@
'use strict'
;
var
Annotator
=
require
(
'annotator'
);
var
unroll
=
require
(
'../../../shared/test/util'
).
unroll
;
var
Guest
=
require
(
'../../guest'
);
...
...
@@ -48,17 +46,18 @@ function FakeCrossFrame() {
describe
(
'anchoring'
,
function
()
{
var
guest
;
var
guestOptions
;
var
container
;
before
(
function
()
{
Annotator
.
Plugin
.
CrossFrame
=
FakeCrossFrame
;
guestOptions
=
{
pluginClasses
:
{
CrossFrame
:
FakeCrossFrame
}}
;
});
beforeEach
(
function
()
{
container
=
document
.
createElement
(
'div'
);
container
.
innerHTML
=
require
(
'./test-page.html'
);
document
.
body
.
appendChild
(
container
);
guest
=
new
Guest
(
container
);
guest
=
new
Guest
(
container
,
guestOptions
);
});
afterEach
(
function
()
{
...
...
src/annotator/test/sidebar-test.coffee
View file @
376da9f8
Annotator
=
require
(
'annotator'
)
events
=
require
(
'../../shared/bridge-events'
)
proxyquire
=
require
(
'proxyquire'
)
Sidebar
=
proxyquire
(
'../sidebar'
,
{
'annotator'
:
Annotator
,
})
Sidebar
=
proxyquire
(
'../sidebar'
,
{})
describe
'Sidebar'
,
->
sandbox
=
sinon
.
sandbox
.
create
()
CrossFrame
=
null
fakeCrossFrame
=
null
sidebarOptions
=
{
pluginClasses
:
{}}
createSidebar
=
(
options
=
{})
->
options
=
Object
.
assign
({},
sidebarOptions
,
options
)
element
=
document
.
createElement
(
'div'
)
return
new
Sidebar
(
element
,
options
)
...
...
@@ -23,11 +22,10 @@ describe 'Sidebar', ->
CrossFrame
=
sandbox
.
stub
()
CrossFrame
.
returns
(
fakeCrossFrame
)
Annotator
.
Plugin
.
CrossFrame
=
CrossFrame
sidebarOptions
.
pluginClasses
[
'CrossFrame'
]
=
CrossFrame
afterEach
->
sandbox
.
restore
()
delete
Annotator
.
Plugin
.
CrossFrame
describe
'crossframe listeners'
,
->
emitEvent
=
(
event
,
args
...)
->
...
...
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