add tests to insure window.location.hash changes & window.history.replaceState cause 'did-navigate-in-page' to fire

This commit is contained in:
leethomas 2016-01-01 18:51:12 -08:00
parent 26397d9155
commit ce733e5927
3 changed files with 35 additions and 0 deletions

View file

@ -0,0 +1,9 @@
<html>
<body>
<script type="text/javascript">
onload = function() {
window.location.hash = 'test';
}
</script>
</body>
</html>

View file

@ -0,0 +1,9 @@
<html>
<body>
<script type="text/javascript">
onload = function() {
window.history.replaceState('test', 'test', 'http://host/');
}
</script>
</body>
</html>

View file

@ -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', ->