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
04761d7d
Commit
04761d7d
authored
Feb 23, 2015
by
csillag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up some tests
parent
e009194e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
controllers-test.coffee
tests/js/controllers-test.coffee
+11
-10
No files found.
tests/js/controllers-test.coffee
View file @
04761d7d
...
@@ -42,6 +42,8 @@ describe 'h', ->
...
@@ -42,6 +42,8 @@ describe 'h', ->
fakeThreading
=
fakeThreading
=
idTable
:
{}
idTable
:
{}
register
:
(
annotation
)
->
@
idTable
[
annotation
.
id
]
=
message
:
annotation
$provide
.
value
'identity'
,
fakeIdentity
$provide
.
value
'identity'
,
fakeIdentity
$provide
.
value
'streamer'
,
fakeStreamer
$provide
.
value
'streamer'
,
fakeStreamer
...
@@ -101,25 +103,24 @@ describe 'h', ->
...
@@ -101,25 +103,24 @@ describe 'h', ->
createController
()
createController
()
$scope
.
$emit
=
sinon
.
spy
()
$scope
.
$emit
=
sinon
.
spy
()
# Prepare the annotation that will come "from the wire"
anns
=
[
id
:
"fakeId"
data
:
"remote data"
]
# Prepare the annotation that we have locally
# Prepare the annotation that we have locally
localAnnotation
=
localAnnotation
=
id
:
"fake
it
"
id
:
"fake
ID
"
data
:
"local data"
data
:
"local data"
# Put our annotation into the threading id table
# Introduce our annotation into threading
fakeThreading
.
idTable
.
fakeId
=
message
:
localAnnotation
fakeThreading
.
register
localAnnotation
# Prepare the annotation that will come "from the wire"
remoteAnnotation
=
id
:
localAnnotation
.
id
# same id as locally
data
:
"remote data"
# different data
# Simulate a delete action
# Simulate a delete action
fakeStreamer
.
onmessage
fakeStreamer
.
onmessage
type
:
"annotation-notification"
type
:
"annotation-notification"
options
:
action
:
"delete"
options
:
action
:
"delete"
payload
:
anns
payload
:
[
remoteAnnotation
]
assert
.
calledWith
$scope
.
$emit
,
"annotationDeleted"
,
localAnnotation
assert
.
calledWith
$scope
.
$emit
,
"annotationDeleted"
,
localAnnotation
...
...
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