add test
This commit is contained in:
parent
b0e8cafa00
commit
f8185296f4
2 changed files with 23 additions and 0 deletions
8
spec/fixtures/pages/history.html
vendored
Normal file
8
spec/fixtures/pages/history.html
vendored
Normal 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>
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue