From 64d436682c22c6013a5394104d59b728014714e8 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 8 Sep 2016 17:38:40 -0700 Subject: [PATCH] Verify resolving URL via console-message event --- spec/webview-spec.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/spec/webview-spec.js b/spec/webview-spec.js index 7df09bfe8396..6b36c84fd645 100644 --- a/spec/webview-spec.js +++ b/spec/webview-spec.js @@ -76,9 +76,15 @@ describe(' tag', function () { document.body.appendChild(webview) }) - it('resolves relative URLs', function () { - webview.src = '../fixtures/test.html' - assert.equal(webview.src, 'file://' + fixtures + '/test.html') + it('resolves relative URLs', function (done) { + var listener = function (e) { + assert.equal(e.message, 'Window script is loaded before preload script') + webview.removeEventListener('console-message', listener) + done() + } + webview.addEventListener('console-message', listener) + webview.src = '../fixtures/pages/e.html' + document.body.appendChild(webview) }) it('ignores empty values', function () { @@ -214,9 +220,16 @@ describe(' tag', function () { document.body.appendChild(webview) }) - it('resolves relative URLs', function () { - webview.preload = '../fixtures/test.js' - assert.equal(webview.preload, 'file://' + fixtures + '/test.js') + it('resolves relative URLs', function (done) { + var listener = function (e) { + assert.equal(e.message, 'function object object') + webview.removeEventListener('console-message', listener) + done() + } + webview.addEventListener('console-message', listener) + webview.src = 'file://' + fixtures + '/pages/e.html' + webview.preload = '../fixtures/module/preload.js' + document.body.appendChild(webview) }) it('ignores empty values', function () {