|
@@ -8,7 +8,9 @@ describe('<webview> tag', function () {
|
|
|
this.timeout(20000)
|
|
|
|
|
|
var fixtures = path.join(__dirname, 'fixtures')
|
|
|
+
|
|
|
var webview = null
|
|
|
+ let w = null
|
|
|
|
|
|
beforeEach(function () {
|
|
|
webview = new WebView()
|
|
@@ -18,17 +20,38 @@ describe('<webview> tag', function () {
|
|
|
if (document.body.contains(webview)) {
|
|
|
document.body.removeChild(webview)
|
|
|
}
|
|
|
+ if (w) {
|
|
|
+ w.destroy()
|
|
|
+ w = null
|
|
|
+ }
|
|
|
})
|
|
|
|
|
|
it('works without script tag in page', function (done) {
|
|
|
- let w = new BrowserWindow({show: false})
|
|
|
+ w = new BrowserWindow({show: false})
|
|
|
ipcMain.once('pong', function () {
|
|
|
- w.destroy()
|
|
|
done()
|
|
|
})
|
|
|
w.loadURL('file://' + fixtures + '/pages/webview-no-script.html')
|
|
|
})
|
|
|
|
|
|
+ it('is disabled when nodeIntegration is disabled', function (done) {
|
|
|
+ w = new BrowserWindow({
|
|
|
+ show: false,
|
|
|
+ webPreferences: {
|
|
|
+ nodeIntegration: false,
|
|
|
+ preload: path.join(fixtures, 'module', 'preload-webview.js')
|
|
|
+ },
|
|
|
+ })
|
|
|
+ ipcMain.once('webview', function (event, type) {
|
|
|
+ if (type === 'undefined') {
|
|
|
+ done()
|
|
|
+ } else {
|
|
|
+ done('WebView still exists')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ w.loadURL('file://' + fixtures + '/pages/webview-no-script.html')
|
|
|
+ })
|
|
|
+
|
|
|
describe('src attribute', function () {
|
|
|
it('specifies the page to load', function (done) {
|
|
|
webview.addEventListener('console-message', function (e) {
|