diff --git a/spec/fixtures/module/preload.js b/spec/fixtures/module/preload.js new file mode 100644 index 000000000000..205a077ddb10 --- /dev/null +++ b/spec/fixtures/module/preload.js @@ -0,0 +1 @@ +console.log([typeof require, typeof module, typeof process].join(' ')); diff --git a/spec/fixtures/pages/e.html b/spec/fixtures/pages/e.html new file mode 100644 index 000000000000..81a2d2b2d69e --- /dev/null +++ b/spec/fixtures/pages/e.html @@ -0,0 +1,7 @@ + + + + + diff --git a/spec/webview-spec.coffee b/spec/webview-spec.coffee index 09c7709c08be..71c4854d5ff9 100644 --- a/spec/webview-spec.coffee +++ b/spec/webview-spec.coffee @@ -47,6 +47,17 @@ describe ' tag', -> webview.src = "file://#{fixtures}/pages/d.html" document.body.appendChild webview + describe 'preload attribute', -> + it 'loads the script before other scripts in window', (done) -> + listener = (e) -> + assert.equal e.message, 'function object object' + webview.removeEventListener 'console-message', listener + done() + webview.addEventListener 'console-message', listener + webview.setAttribute 'preload', "#{fixtures}/module/preload.js" + webview.src = "file://#{fixtures}/pages/e.html" + document.body.appendChild webview + describe 'new-window event', -> it 'emits when window.open is called', (done) -> webview.addEventListener 'new-window', (e) ->