standardize by hand

This commit is contained in:
Zeke Sikelianos 2016-03-28 17:16:08 -07:00 committed by Kevin Sawicki
parent fd0f9519f1
commit cfdfdc8ccc
2 changed files with 16 additions and 18 deletions

View file

@ -1,3 +1,5 @@
/* globals Event, HTMLObjectElement */
'use strict' 'use strict'
const deprecate = require('electron').deprecate const deprecate = require('electron').deprecate
@ -72,7 +74,7 @@ var WebViewImpl = (function () {
this.beforeFirstNavigation = true this.beforeFirstNavigation = true
this.attributes[webViewConstants.ATTRIBUTE_PARTITION].validPartitionId = true this.attributes[webViewConstants.ATTRIBUTE_PARTITION].validPartitionId = true
} }
return this.internalInstanceId = 0 this.internalInstanceId = 0
} }
// Sets the <webview>.request property. // Sets the <webview>.request property.
@ -267,7 +269,7 @@ var registerBrowserPluginElement = function () {
this.setAttribute('id', 'browser-plugin-' + getNextId()) this.setAttribute('id', 'browser-plugin-' + getNextId())
// The <object> node fills in the <webview> container. // The <object> node fills in the <webview> container.
return this.style.flex = '1 1 auto' this.style.flex = '1 1 auto'
} }
proto.attributeChangedCallback = function (name, oldValue, newValue) { proto.attributeChangedCallback = function (name, oldValue, newValue) {
var internal var internal
@ -374,7 +376,7 @@ var registerWebViewElement = function () {
'downloadURL', 'downloadURL',
'inspectServiceWorker', 'inspectServiceWorker',
'print', 'print',
'printToPDF', 'printToPDF'
] ]
nonblockMethods = [ nonblockMethods = [
'insertCSS', 'insertCSS',
@ -383,7 +385,7 @@ var registerWebViewElement = function () {
'sendInputEvent', 'sendInputEvent',
'setZoomFactor', 'setZoomFactor',
'setZoomLevel', 'setZoomLevel',
'setZoomLevelLimits', 'setZoomLevelLimits'
] ]
// Forward proto.foo* method calls to WebViewImpl.foo*. // Forward proto.foo* method calls to WebViewImpl.foo*.

View file

@ -87,9 +87,9 @@ describe('browser-window module', function () {
it('prevents users to access methods of webContents', function () { it('prevents users to access methods of webContents', function () {
var webContents = w.webContents var webContents = w.webContents
w.destroy() w.destroy()
assert.throws((function () { assert.throws(function () {
webContents.getId() webContents.getId()
}), /Object has been destroyed/) }, /Object has been destroyed/)
}) })
}) })
@ -522,8 +522,7 @@ describe('browser-window module', function () {
w.loadURL('file://' + fixtures + '/api/blank.html') w.loadURL('file://' + fixtures + '/api/blank.html')
w.webContents.beginFrameSubscription(function (data) { w.webContents.beginFrameSubscription(function (data) {
// This callback might be called twice. // This callback might be called twice.
if (called) if (called) return
return
called = true called = true
assert.notEqual(data.length, 0) assert.notEqual(data.length, 0)
@ -595,8 +594,7 @@ describe('browser-window module', function () {
describe('window states (excluding Linux)', function () { describe('window states (excluding Linux)', function () {
// Not implemented on Linux. // Not implemented on Linux.
if (process.platform == 'linux') if (process.platform === 'linux') return
return
describe('movable state', function () { describe('movable state', function () {
it('can be changed with movable option', function () { it('can be changed with movable option', function () {
@ -657,8 +655,7 @@ describe('browser-window module', function () {
describe('fullscreenable state', function () { describe('fullscreenable state', function () {
// Only implemented on OS X. // Only implemented on OS X.
if (process.platform != 'darwin') if (process.platform !== 'darwin') return
return
it('can be changed with fullscreenable option', function () { it('can be changed with fullscreenable option', function () {
w.destroy() w.destroy()
@ -696,14 +693,13 @@ describe('browser-window module', function () {
// dynamically. // dynamically.
it('can be changed with hasShadow option', function () { it('can be changed with hasShadow option', function () {
w.destroy() w.destroy()
let hasShadow = process.platform == 'darwin' ? false : true let hasShadow = process.platform !== 'darwin'
w = new BrowserWindow({show: false, hasShadow: hasShadow}) w = new BrowserWindow({show: false, hasShadow: hasShadow})
assert.equal(w.hasShadow(), hasShadow) assert.equal(w.hasShadow(), hasShadow)
}) })
it('can be changed with setHasShadow method', function () { it('can be changed with setHasShadow method', function () {
if (process.platform != 'darwin') if (process.platform !== 'darwin') return
return
assert.equal(w.hasShadow(), true) assert.equal(w.hasShadow(), true)
w.setHasShadow(false) w.setHasShadow(false)
@ -763,19 +759,19 @@ describe('browser-window module', function () {
describe('deprecated options', function () { describe('deprecated options', function () {
it('throws a deprecation error for option keys using hyphens instead of camel case', function () { it('throws a deprecation error for option keys using hyphens instead of camel case', function () {
assert.throws(function () { assert.throws(function () {
new BrowserWindow({'min-width': 500}) new BrowserWindow({'min-width': 500}) // eslint-disable-line
}, 'min-width is deprecated. Use minWidth instead.') }, 'min-width is deprecated. Use minWidth instead.')
}) })
it('throws a deprecation error for webPreference keys using hyphens instead of camel case', function () { it('throws a deprecation error for webPreference keys using hyphens instead of camel case', function () {
assert.throws(function () { assert.throws(function () {
new BrowserWindow({webPreferences: {'node-integration': false}}) new BrowserWindow({webPreferences: {'node-integration': false}}) // eslint-disable-line
}, 'node-integration is deprecated. Use nodeIntegration instead.') }, 'node-integration is deprecated. Use nodeIntegration instead.')
}) })
it('throws a deprecation error for option keys that should be set on webPreferences', function () { it('throws a deprecation error for option keys that should be set on webPreferences', function () {
assert.throws(function () { assert.throws(function () {
new BrowserWindow({zoomFactor: 1}) new BrowserWindow({zoomFactor: 1}) // eslint-disable-line
}, 'options.zoomFactor is deprecated. Use options.webPreferences.zoomFactor instead.') }, 'options.zoomFactor is deprecated. Use options.webPreferences.zoomFactor instead.')
}) })
}) })