Add a test to verify the webview close event

This commit is contained in:
Paul Betts 2015-07-08 14:34:44 -07:00
parent 083d0b8b60
commit ea63a04388
2 changed files with 18 additions and 1 deletions

9
spec/fixtures/pages/close.html vendored Normal file
View file

@ -0,0 +1,9 @@
<html>
<link rel="icon" type="image/png" href="/favicon.png"/>
<link rel="icon" type="image/png" href="http://test.com/favicon.png"/>
<body>
<script type="text/javascript" charset="utf-8">
window.close();
</script>
</body>
</html>

View file

@ -191,6 +191,14 @@ describe '<webview> tag', ->
webview.src = "file://#{fixtures}/pages/a.html"
document.body.appendChild webview
describe 'close event', ->
it 'should fire when interior page calls window.close', ->
webview.addEventListener 'close', ->
done()
webview.src = "file://#{fixtures}/pages/close.html"
document.body.appendChild webview
describe '<webview>.reload()', ->
it 'should emit beforeunload handler', (done) ->
listener = (e) ->
@ -217,6 +225,6 @@ describe '<webview> tag', ->
webview.removeEventListener 'ipc-message', listener
done()
webview.addEventListener 'ipc-message', listener
webview.setAttribute 'nodeintegration', 'on'
webview.setAttribute 'nodeintegration', 'on'
webview.src = "file://#{fixtures}/pages/history.html"
document.body.appendChild webview