mirror of
https://github.com/electron/electron.git
synced 2026-01-23 14:28:17 -05:00
spec: "will-navigate" event
This commit is contained in:
@@ -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"
|
||||
|
||||
7
spec/fixtures/pages/will-navigate.html
vendored
Normal file
7
spec/fixtures/pages/will-navigate.html
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
location = 'https://www.github.com'
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user