spec: Add test for allowpopups attribute
This commit is contained in:
Родитель
9cbdde2eba
Коммит
f06f8ae73b
|
@ -0,0 +1,12 @@
|
|||
<html>
|
||||
<body>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var w = window.open('http://host', '', 'show=no');
|
||||
if (w == null)
|
||||
console.log('null');
|
||||
else
|
||||
console.log('window');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -201,6 +201,26 @@ describe '<webview> tag', ->
|
|||
webview.src = "file://#{fixtures}/pages/partition/one.html"
|
||||
document.body.appendChild webview
|
||||
|
||||
describe 'allowpopups attribute', ->
|
||||
it 'can not open new window when not set', (done) ->
|
||||
listener = (e) ->
|
||||
assert.equal e.message, 'null'
|
||||
webview.removeEventListener 'console-message', listener
|
||||
done()
|
||||
webview.addEventListener 'console-message', listener
|
||||
webview.src = "file://#{fixtures}/pages/window-open-hide.html"
|
||||
document.body.appendChild webview
|
||||
|
||||
it 'can open new window when set', (done) ->
|
||||
listener = (e) ->
|
||||
assert.equal e.message, 'window'
|
||||
webview.removeEventListener 'console-message', listener
|
||||
done()
|
||||
webview.addEventListener 'console-message', listener
|
||||
webview.setAttribute 'allowpopups', 'on'
|
||||
webview.src = "file://#{fixtures}/pages/window-open-hide.html"
|
||||
document.body.appendChild webview
|
||||
|
||||
describe 'new-window event', ->
|
||||
it 'emits when window.open is called', (done) ->
|
||||
webview.addEventListener 'new-window', (e) ->
|
||||
|
|
Загрузка…
Ссылка в новой задаче