diff --git a/spec/fixtures/pages/history.html b/spec/fixtures/pages/history.html new file mode 100644 index 000000000000..b5029d638926 --- /dev/null +++ b/spec/fixtures/pages/history.html @@ -0,0 +1,8 @@ + + + + + diff --git a/spec/webview-spec.coffee b/spec/webview-spec.coffee index 54bc2e78817f..3606c363c63a 100644 --- a/spec/webview-spec.coffee +++ b/spec/webview-spec.coffee @@ -193,3 +193,18 @@ describe ' tag', -> webview.setAttribute 'nodeintegration', 'on' webview.src = "file://#{fixtures}/pages/beforeunload-false.html" document.body.appendChild webview + + describe '.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