This commit is contained in:
deepak1556 2015-05-20 09:23:08 +05:30
parent b0e8cafa00
commit f8185296f4
2 changed files with 23 additions and 0 deletions

8
spec/fixtures/pages/history.html vendored Normal file
View file

@ -0,0 +1,8 @@
<html>
<body>
<script type="text/javascript" charset="utf-8">
window.history.pushState(window.history.state, "test page", "foo.html")
require('ipc').sendToHost('history', window.history.length);
</script>
</body>
</html>

View file

@ -193,3 +193,18 @@ describe '<webview> tag', ->
webview.setAttribute 'nodeintegration', 'on'
webview.src = "file://#{fixtures}/pages/beforeunload-false.html"
document.body.appendChild webview
describe '<webview>.clearHistory()', ->
it 'should clear the navigation history', (done) ->
listener = (e) ->
assert.equal e.channel, 'history'
assert.equal e.args[0], 2
assert webview.canGoBack()
webview.clearHistory()
assert not webview.canGoBack()
webview.removeEventListener 'ipc-message', listener
done()
webview.addEventListener 'ipc-message', listener
webview.setAttribute 'nodeintegration', 'on'
webview.src = "file://#{fixtures}/pages/history.html"
document.body.appendChild webview