spec: ipc-message event

This commit is contained in:
Cheng Zhao 2014-12-16 21:11:30 -08:00
parent 95793e410d
commit c0285747a2
2 changed files with 17 additions and 0 deletions

7
spec/fixtures/pages/ipc-message.html vendored Normal file
View file

@ -0,0 +1,7 @@
<html>
<body>
<script type="text/javascript" charset="utf-8">
require('ipc').send('channel', 'arg1', 'arg2');
</script>
</body>
</html>

View file

@ -86,3 +86,13 @@ describe '<webview> tag', ->
done()
webview.src = "file://#{fixtures}/pages/target-name.html"
document.body.appendChild webview
describe 'ipc-message event', ->
it 'emits when guest sends a ipc message to browser', (done) ->
webview.addEventListener 'ipc-message', (e) ->
assert.equal e.channel, 'channel'
assert.deepEqual e.args, ['arg1', 'arg2']
done()
webview.src = "file://#{fixtures}/pages/ipc-message.html"
webview.setAttribute 'nodeintegration', 'on'
document.body.appendChild webview