spec: "will-navigate" event

This commit is contained in:
Cheng Zhao 2014-12-17 15:03:34 -08:00
parent c2975d2bcc
commit eaacf0a6ef
2 changed files with 15 additions and 0 deletions

View file

@ -208,3 +208,11 @@ describe 'browser-window module', ->
w.once 'minimize', -> done()
w.show()
w.minimize()
describe 'will-navigate event', ->
it 'emits when user starts a navigation', (done) ->
w.webContents.on 'will-navigate', (event, url) ->
event.preventDefault()
assert.equal url, 'https://www.github.com/'
done()
w.loadUrl "file://#{fixtures}/pages/will-navigate.html"

View file

@ -0,0 +1,7 @@
<html>
<body>
<script type="text/javascript" charset="utf-8">
location = 'https://www.github.com'
</script>
</body>
</html>