🔧 Spec: Fix style issues
This commit is contained in:
parent
0278e380de
commit
9f0df695ca
13 changed files with 49 additions and 5 deletions
|
@ -153,7 +153,7 @@ describe('BrowserWindow module', () => {
|
||||||
]
|
]
|
||||||
const responseEvent = 'window-webContents-destroyed'
|
const responseEvent = 'window-webContents-destroyed'
|
||||||
|
|
||||||
function* genNavigationEvent () {
|
function * genNavigationEvent () {
|
||||||
let eventOptions = null
|
let eventOptions = null
|
||||||
while ((eventOptions = events.shift()) && events.length) {
|
while ((eventOptions = events.shift()) && events.length) {
|
||||||
let w = new BrowserWindow({show: false})
|
let w = new BrowserWindow({show: false})
|
||||||
|
@ -1056,6 +1056,8 @@ describe('BrowserWindow module', () => {
|
||||||
// http protocol to simulate accessing another domain. This is required
|
// http protocol to simulate accessing another domain. This is required
|
||||||
// because the code paths for cross domain popups is different.
|
// because the code paths for cross domain popups is different.
|
||||||
function crossDomainHandler (request, callback) {
|
function crossDomainHandler (request, callback) {
|
||||||
|
// Disabled due to false positive in StandardJS
|
||||||
|
// eslint-disable-next-line standard/no-callback-literal
|
||||||
callback({
|
callback({
|
||||||
mimeType: 'text/html',
|
mimeType: 'text/html',
|
||||||
data: `<html><body><h1>${request.url}</h1></body></html>`
|
data: `<html><body><h1>${request.url}</h1></body></html>`
|
||||||
|
@ -3025,6 +3027,8 @@ const isScaleFactorRounding = () => {
|
||||||
function serveFileFromProtocol (protocolName, filePath) {
|
function serveFileFromProtocol (protocolName, filePath) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
protocol.registerBufferProtocol(protocolName, (request, callback) => {
|
protocol.registerBufferProtocol(protocolName, (request, callback) => {
|
||||||
|
// Disabled due to false positive in StandardJS
|
||||||
|
// eslint-disable-next-line standard/no-callback-literal
|
||||||
callback({
|
callback({
|
||||||
mimeType: 'text/html',
|
mimeType: 'text/html',
|
||||||
data: fs.readFileSync(filePath)
|
data: fs.readFileSync(filePath)
|
||||||
|
|
|
@ -195,6 +195,7 @@ describe('ipc module', () => {
|
||||||
const foo = remote.require(path.join(fixtures, 'module', 'error-properties.js'))
|
const foo = remote.require(path.join(fixtures, 'module', 'error-properties.js'))
|
||||||
|
|
||||||
assert.throws(() => {
|
assert.throws(() => {
|
||||||
|
// eslint-disable-next-line
|
||||||
foo.bar
|
foo.bar
|
||||||
}, /getting error/)
|
}, /getting error/)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
|
/* eslint-disable no-unused-expressions */
|
||||||
|
|
||||||
const {expect} = require('chai')
|
const {expect} = require('chai')
|
||||||
const {nativeImage} = require('electron')
|
const {nativeImage} = require('electron')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
|
@ -6,6 +6,9 @@ const url = require('url')
|
||||||
const {net} = remote
|
const {net} = remote
|
||||||
const {session} = remote
|
const {session} = remote
|
||||||
|
|
||||||
|
/* The whole net API doesn't use standard callbacks */
|
||||||
|
/* eslint-disable standard/no-callback-literal */
|
||||||
|
|
||||||
function randomBuffer (size, start, end) {
|
function randomBuffer (size, start, end) {
|
||||||
start = start || 0
|
start = start || 0
|
||||||
end = end || 255
|
end = end || 255
|
||||||
|
@ -855,6 +858,8 @@ describe('net module', () => {
|
||||||
(details, callback) => {
|
(details, callback) => {
|
||||||
if (details.url === `${server.url}${requestUrl}`) {
|
if (details.url === `${server.url}${requestUrl}`) {
|
||||||
requestIsIntercepted = true
|
requestIsIntercepted = true
|
||||||
|
// Disabled due to false positive in StandardJS
|
||||||
|
// eslint-disable-next-line standard/no-callback-literal
|
||||||
callback({
|
callback({
|
||||||
redirectURL: `${server.url}${redirectUrl}`
|
redirectURL: `${server.url}${redirectUrl}`
|
||||||
})
|
})
|
||||||
|
@ -907,6 +912,8 @@ describe('net module', () => {
|
||||||
customSession.webRequest.onBeforeRequest((details, callback) => {
|
customSession.webRequest.onBeforeRequest((details, callback) => {
|
||||||
if (details.url === `${server.url}${requestUrl}`) {
|
if (details.url === `${server.url}${requestUrl}`) {
|
||||||
requestIsIntercepted = true
|
requestIsIntercepted = true
|
||||||
|
// Disabled due to false positive in StandardJS
|
||||||
|
// eslint-disable-next-line standard/no-callback-literal
|
||||||
callback({
|
callback({
|
||||||
redirectURL: `${server.url}${redirectUrl}`
|
redirectURL: `${server.url}${redirectUrl}`
|
||||||
})
|
})
|
||||||
|
@ -1154,6 +1161,8 @@ describe('net module', () => {
|
||||||
url: `${server.url}${requestUrl}`,
|
url: `${server.url}${requestUrl}`,
|
||||||
session: 1
|
session: 1
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// eslint-disable-next-line
|
||||||
urlRequest
|
urlRequest
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
done()
|
done()
|
||||||
|
@ -1223,6 +1232,8 @@ describe('net module', () => {
|
||||||
url: `${server.url}${requestUrl}`,
|
url: `${server.url}${requestUrl}`,
|
||||||
partition: 1
|
partition: 1
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// eslint-disable-next-line
|
||||||
urlRequest
|
urlRequest
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
done()
|
done()
|
||||||
|
|
|
@ -10,6 +10,9 @@ const {BrowserWindow, ipcMain, protocol, session, webContents} = remote
|
||||||
// and use Stream instances created in the browser process.
|
// and use Stream instances created in the browser process.
|
||||||
const stream = remote.require('stream')
|
const stream = remote.require('stream')
|
||||||
|
|
||||||
|
/* The whole protocol API doesn't use standard callbacks */
|
||||||
|
/* eslint-disable standard/no-callback-literal */
|
||||||
|
|
||||||
describe('protocol module', () => {
|
describe('protocol module', () => {
|
||||||
const protocolName = 'sp'
|
const protocolName = 'sp'
|
||||||
const text = 'valar morghulis'
|
const text = 'valar morghulis'
|
||||||
|
|
|
@ -10,6 +10,9 @@ const {closeWindow} = require('./window-helpers')
|
||||||
const {ipcRenderer, remote} = require('electron')
|
const {ipcRenderer, remote} = require('electron')
|
||||||
const {ipcMain, session, BrowserWindow, net} = remote
|
const {ipcMain, session, BrowserWindow, net} = remote
|
||||||
|
|
||||||
|
/* The whole session API doesn't use standard callbacks */
|
||||||
|
/* eslint-disable standard/no-callback-literal */
|
||||||
|
|
||||||
describe('session module', () => {
|
describe('session module', () => {
|
||||||
let fixtures = path.resolve(__dirname, 'fixtures')
|
let fixtures = path.resolve(__dirname, 'fixtures')
|
||||||
let w = null
|
let w = null
|
||||||
|
|
|
@ -10,6 +10,9 @@ const {BrowserWindow, webContents, ipcMain, session} = remote
|
||||||
|
|
||||||
const isCi = remote.getGlobal('isCi')
|
const isCi = remote.getGlobal('isCi')
|
||||||
|
|
||||||
|
/* The whole webContents API doesn't use standard callbacks */
|
||||||
|
/* eslint-disable standard/no-callback-literal */
|
||||||
|
|
||||||
describe('webContents module', () => {
|
describe('webContents module', () => {
|
||||||
const fixtures = path.resolve(__dirname, 'fixtures')
|
const fixtures = path.resolve(__dirname, 'fixtures')
|
||||||
let w
|
let w
|
||||||
|
@ -634,7 +637,7 @@ describe('webContents module', () => {
|
||||||
]
|
]
|
||||||
const responseEvent = 'webcontents-destroyed'
|
const responseEvent = 'webcontents-destroyed'
|
||||||
|
|
||||||
function* genNavigationEvent () {
|
function * genNavigationEvent () {
|
||||||
let eventOptions = null
|
let eventOptions = null
|
||||||
while ((eventOptions = events.shift()) && events.length) {
|
while ((eventOptions = events.shift()) && events.length) {
|
||||||
eventOptions.responseEvent = responseEvent
|
eventOptions.responseEvent = responseEvent
|
||||||
|
|
|
@ -4,6 +4,9 @@ const {closeWindow} = require('./window-helpers')
|
||||||
const {remote, webFrame} = require('electron')
|
const {remote, webFrame} = require('electron')
|
||||||
const {BrowserWindow, protocol, ipcMain} = remote
|
const {BrowserWindow, protocol, ipcMain} = remote
|
||||||
|
|
||||||
|
/* Most of the APIs here don't use standard callbacks */
|
||||||
|
/* eslint-disable standard/no-callback-literal */
|
||||||
|
|
||||||
describe('webFrame module', function () {
|
describe('webFrame module', function () {
|
||||||
var fixtures = path.resolve(__dirname, 'fixtures')
|
var fixtures = path.resolve(__dirname, 'fixtures')
|
||||||
var w = null
|
var w = null
|
||||||
|
|
|
@ -4,6 +4,9 @@ const qs = require('querystring')
|
||||||
const remote = require('electron').remote
|
const remote = require('electron').remote
|
||||||
const session = remote.session
|
const session = remote.session
|
||||||
|
|
||||||
|
/* The whole webRequest API doesn't use standard callbacks */
|
||||||
|
/* eslint-disable standard/no-callback-literal */
|
||||||
|
|
||||||
describe('webRequest module', () => {
|
describe('webRequest module', () => {
|
||||||
const ses = session.defaultSession
|
const ses = session.defaultSession
|
||||||
const server = http.createServer((req, res) => {
|
const server = http.createServer((req, res) => {
|
||||||
|
|
|
@ -11,6 +11,9 @@ const {app, BrowserWindow, ipcMain, protocol, session, webContents} = remote
|
||||||
|
|
||||||
const isCI = remote.getGlobal('isCi')
|
const isCI = remote.getGlobal('isCi')
|
||||||
|
|
||||||
|
/* Most of the APIs here don't use standard callbacks */
|
||||||
|
/* eslint-disable standard/no-callback-literal */
|
||||||
|
|
||||||
describe('chromium feature', () => {
|
describe('chromium feature', () => {
|
||||||
const fixtures = path.resolve(__dirname, 'fixtures')
|
const fixtures = path.resolve(__dirname, 'fixtures')
|
||||||
let listener = null
|
let listener = null
|
||||||
|
|
|
@ -298,6 +298,7 @@ describe('node feature', () => {
|
||||||
describe('process.stdout', () => {
|
describe('process.stdout', () => {
|
||||||
it('does not throw an exception when accessed', () => {
|
it('does not throw an exception when accessed', () => {
|
||||||
assert.doesNotThrow(() => {
|
assert.doesNotThrow(() => {
|
||||||
|
// eslint-disable-next-line
|
||||||
process.stdout
|
process.stdout
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -332,7 +333,7 @@ describe('node feature', () => {
|
||||||
describe('process.stdin', () => {
|
describe('process.stdin', () => {
|
||||||
it('does not throw an exception when accessed', () => {
|
it('does not throw an exception when accessed', () => {
|
||||||
assert.doesNotThrow(() => {
|
assert.doesNotThrow(() => {
|
||||||
process.stdin
|
process.stdin // eslint-disable-line
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,11 @@ app.commandLine.appendSwitch('disable-renderer-backgrounding')
|
||||||
// Accessing stdout in the main process will result in the process.stdout
|
// Accessing stdout in the main process will result in the process.stdout
|
||||||
// throwing UnknownSystemError in renderer process sometimes. This line makes
|
// throwing UnknownSystemError in renderer process sometimes. This line makes
|
||||||
// sure we can reproduce it in renderer process.
|
// sure we can reproduce it in renderer process.
|
||||||
|
// eslint-disable-next-line
|
||||||
process.stdout
|
process.stdout
|
||||||
|
|
||||||
// Access console to reproduce #3482.
|
// Access console to reproduce #3482.
|
||||||
|
// eslint-disable-next-line
|
||||||
console
|
console
|
||||||
|
|
||||||
ipcMain.on('message', function (event, ...args) {
|
ipcMain.on('message', function (event, ...args) {
|
||||||
|
@ -378,6 +380,8 @@ const suspendListeners = (emitter, eventName, callback) => {
|
||||||
listeners.forEach((listener) => {
|
listeners.forEach((listener) => {
|
||||||
emitter.on(eventName, listener)
|
emitter.on(eventName, listener)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// eslint-disable-next-line standard/no-callback-literal
|
||||||
callback(...args)
|
callback(...args)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,9 @@ const {closeWindow} = require('./window-helpers')
|
||||||
const isCI = remote.getGlobal('isCi')
|
const isCI = remote.getGlobal('isCi')
|
||||||
const nativeModulesEnabled = remote.getGlobal('nativeModulesEnabled')
|
const nativeModulesEnabled = remote.getGlobal('nativeModulesEnabled')
|
||||||
|
|
||||||
|
/* Most of the APIs here don't use standard callbacks */
|
||||||
|
/* eslint-disable standard/no-callback-literal */
|
||||||
|
|
||||||
describe('<webview> tag', function () {
|
describe('<webview> tag', function () {
|
||||||
this.timeout(3 * 60 * 1000)
|
this.timeout(3 * 60 * 1000)
|
||||||
|
|
||||||
|
@ -1423,7 +1426,7 @@ describe('<webview> tag', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
webview.style.display = 'none'
|
webview.style.display = 'none'
|
||||||
webview.offsetHeight
|
webview.offsetHeight // eslint-disable-line
|
||||||
webview.style.display = 'block'
|
webview.style.display = 'block'
|
||||||
})
|
})
|
||||||
webview.src = `file://${fixtures}/pages/a.html`
|
webview.src = `file://${fixtures}/pages/a.html`
|
||||||
|
@ -1442,7 +1445,7 @@ describe('<webview> tag', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
webview.style.display = 'none'
|
webview.style.display = 'none'
|
||||||
webview.offsetHeight
|
webview.offsetHeight // eslint-disable-line
|
||||||
webview.style.display = 'block'
|
webview.style.display = 'block'
|
||||||
})
|
})
|
||||||
webview.src = `file://${fixtures}/pages/a.html`
|
webview.src = `file://${fixtures}/pages/a.html`
|
||||||
|
|
Loading…
Reference in a new issue