spec: "httpreferrer" attribute of <webview>

This commit is contained in:
Cheng Zhao 2014-11-12 10:39:15 +08:00
parent 57bfc63d23
commit db8361a0a9
2 changed files with 19 additions and 0 deletions

7
spec/fixtures/pages/referrer.html vendored Normal file
View file

@ -0,0 +1,7 @@
<html>
<body>
<script type="text/javascript" charset="utf-8">
console.log(document.referrer);
</script>
</body>
</html>

View file

@ -58,6 +58,18 @@ describe '<webview> tag', ->
webview.src = "file://#{fixtures}/pages/e.html" webview.src = "file://#{fixtures}/pages/e.html"
document.body.appendChild webview document.body.appendChild webview
describe 'httpreferrer attribute', ->
it 'sets the referrer url', (done) ->
referrer = 'http://github.com/'
listener = (e) ->
assert.equal e.message, referrer
webview.removeEventListener 'console-message', listener
done()
webview.addEventListener 'console-message', listener
webview.setAttribute 'httpreferrer', referrer
webview.src = "file://#{fixtures}/pages/referrer.html"
document.body.appendChild webview
describe 'new-window event', -> describe 'new-window event', ->
it 'emits when window.open is called', (done) -> it 'emits when window.open is called', (done) ->
webview.addEventListener 'new-window', (e) -> webview.addEventListener 'new-window', (e) ->