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
e9af1799
Commit
e9af1799
authored
Feb 02, 2015
by
Aron Carroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test CrossFrameBridge.call with multiple channels
parent
40aa21bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
cross-frame-bridge-test.coffee
tests/js/cross-frame-bridge-test.coffee
+18
-8
No files found.
tests/js/cross-frame-bridge-test.coffee
View file @
e9af1799
...
...
@@ -93,29 +93,39 @@ describe 'CrossFrameBridge', ->
assert
.
isNumber
(
message
.
timeout
)
it
'calls options.callback when all channels return successfully'
,
->
channel
=
createChannel
()
channel
.
call
.
yieldsTo
(
'success'
,
'result'
)
Channel
.
build
.
returns
(
channel
)
channel1
=
createChannel
()
channel2
=
createChannel
()
channel1
.
call
.
yieldsTo
(
'success'
,
'result1'
)
channel2
.
call
.
yieldsTo
(
'success'
,
'result2'
)
callback
=
sandbox
.
stub
()
bridge
=
createBridge
()
Channel
.
build
.
returns
(
channel1
)
bridge
.
createChannel
(
'WINDOW'
,
'ORIGIN'
,
'TOKEN'
)
Channel
.
build
.
returns
(
channel2
)
bridge
.
createChannel
(
'WINDOW'
,
'ORIGIN'
,
'TOKEN'
)
bridge
.
call
({
method
:
'method1'
,
params
:
'params1'
,
callback
:
callback
})
assert
.
called
(
callback
)
assert
.
calledWith
(
callback
,
null
,
[
'result'
])
assert
.
calledWith
(
callback
,
null
,
[
'result
1'
,
'result2
'
])
it
'calls options.callback with an error when one or more channels fail'
,
->
err
=
new
Error
(
'Uh oh'
)
channel
=
createChannel
()
channel
.
call
.
yieldsTo
(
'error'
,
err
,
'A reason for the error'
)
Channel
.
build
.
returns
(
channel
)
channel1
=
createChannel
()
channel1
.
call
.
yieldsTo
(
'error'
,
err
,
'A reason for the error'
)
channel2
=
createChannel
()
channel2
.
call
.
yieldsTo
(
'success'
,
'result2'
)
callback
=
sandbox
.
stub
()
bridge
=
createBridge
()
Channel
.
build
.
returns
(
channel1
)
bridge
.
createChannel
(
'WINDOW'
,
'ORIGIN'
,
'TOKEN'
)
Channel
.
build
.
returns
(
channel2
)
bridge
.
createChannel
(
'WINDOW'
,
'ORIGIN'
,
'TOKEN'
)
bridge
.
call
({
method
:
'method1'
,
params
:
'params1'
,
callback
:
callback
})
assert
.
called
(
callback
)
...
...
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