✅ add tests to insure window.location.hash changes & window.history.replaceState cause 'did-navigate-in-page' to fire
This commit is contained in:
parent
26397d9155
commit
ce733e5927
3 changed files with 35 additions and 0 deletions
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', ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue