mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
✅ add tests to insure window.location.hash changes & window.history.replaceState cause 'did-navigate-in-page' to fire
This commit is contained in:
9
spec/fixtures/pages/webview-did-navigate-in-page-with-hash.html
vendored
Normal file
9
spec/fixtures/pages/webview-did-navigate-in-page-with-hash.html
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<html>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
onload = function() {
|
||||
window.location.hash = 'test';
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
9
spec/fixtures/pages/webview-did-navigate-in-page-with-history.html
vendored
Normal file
9
spec/fixtures/pages/webview-did-navigate-in-page-with-history.html
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<html>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
onload = function() {
|
||||
window.history.replaceState('test', 'test', 'http://host/');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -301,6 +301,23 @@ describe '<webview> tag', ->
|
||||
webview.src = page_url
|
||||
document.body.appendChild webview
|
||||
|
||||
it 'emits when window.history.replaceState is called', (done) ->
|
||||
webview.addEventListener 'did-navigate-in-page', (e) ->
|
||||
assert.equal e.url, "http://host/"
|
||||
done()
|
||||
|
||||
webview.src = "file://#{fixtures}/pages/webview-did-navigate-in-page-with-history.html"
|
||||
document.body.appendChild webview
|
||||
|
||||
it 'emits when window.location.hash is changed', (done) ->
|
||||
page_url = "file://#{fixtures}/pages/webview-did-navigate-in-page-with-hash.html"
|
||||
webview.addEventListener 'did-navigate-in-page', (e) ->
|
||||
assert.equal e.url, "#{page_url}#test"
|
||||
done()
|
||||
|
||||
webview.src = page_url
|
||||
document.body.appendChild webview
|
||||
|
||||
describe 'close event', ->
|
||||
it 'should fire when interior page calls window.close', (done) ->
|
||||
webview.addEventListener 'close', ->
|
||||
|
||||
Reference in New Issue
Block a user