diff --git a/spec/api-clipboard-spec.js b/spec/api-clipboard-spec.js index 84a4de742eab..e9a5c58fee9a 100644 --- a/spec/api-clipboard-spec.js +++ b/spec/api-clipboard-spec.js @@ -4,45 +4,45 @@ const {Buffer} = require('buffer') const {clipboard, nativeImage} = require('electron') -describe('clipboard module', function () { - var fixtures = path.resolve(__dirname, 'fixtures') +describe('clipboard module', () => { + const fixtures = path.resolve(__dirname, 'fixtures') - describe('clipboard.readImage()', function () { - it('returns NativeImage intance', function () { - var p = path.join(fixtures, 'assets', 'logo.png') - var i = nativeImage.createFromPath(p) + describe('clipboard.readImage()', () => { + it('returns NativeImage instance', () => { + const p = path.join(fixtures, 'assets', 'logo.png') + const i = nativeImage.createFromPath(p) clipboard.writeImage(p) assert.equal(clipboard.readImage().toDataURL(), i.toDataURL()) }) }) - describe('clipboard.readText()', function () { - it('returns unicode string correctly', function () { - var text = '千江有水千江月,万里无云万里天' + describe('clipboard.readText()', () => { + it('returns unicode string correctly', () => { + const text = '千江有水千江月,万里无云万里天' clipboard.writeText(text) assert.equal(clipboard.readText(), text) }) }) - describe('clipboard.readHTML()', function () { - it('returns markup correctly', function () { - var text = 'Hi' - var markup = process.platform === 'darwin' ? "Hi" : process.platform === 'linux' ? 'Hi' : 'Hi' + describe('clipboard.readHTML()', () => { + it('returns markup correctly', () => { + const text = 'Hi' + const markup = process.platform === 'darwin' ? "Hi" : process.platform === 'linux' ? 'Hi' : 'Hi' clipboard.writeHTML(text) assert.equal(clipboard.readHTML(), markup) }) }) - describe('clipboard.readRTF', function () { - it('returns rtf text correctly', function () { - var rtf = '{\\rtf1\\ansi{\\fonttbl\\f0\\fswiss Helvetica;}\\f0\\pard\nThis is some {\\b bold} text.\\par\n}' + describe('clipboard.readRTF', () => { + it('returns rtf text correctly', () => { + const rtf = '{\\rtf1\\ansi{\\fonttbl\\f0\\fswiss Helvetica;}\\f0\\pard\nThis is some {\\b bold} text.\\par\n}' clipboard.writeRTF(rtf) assert.equal(clipboard.readRTF(), rtf) }) }) - describe('clipboard.readBookmark', function () { - it('returns title and url', function () { + describe('clipboard.readBookmark', () => { + it('returns title and url', () => { if (process.platform === 'linux') return clipboard.writeBookmark('a title', 'https://electron.atom.io') @@ -59,14 +59,14 @@ describe('clipboard module', function () { }) }) - describe('clipboard.write()', function () { - it('returns data correctly', function () { - var text = 'test' - var rtf = '{\\rtf1\\utf8 text}' - var p = path.join(fixtures, 'assets', 'logo.png') - var i = nativeImage.createFromPath(p) - var markup = process.platform === 'darwin' ? "Hi" : process.platform === 'linux' ? 'Hi' : 'Hi' - var bookmark = {title: 'a title', url: 'test'} + describe('clipboard.write()', () => { + it('returns data correctly', () => { + const text = 'test' + const rtf = '{\\rtf1\\utf8 text}' + const p = path.join(fixtures, 'assets', 'logo.png') + const i = nativeImage.createFromPath(p) + const markup = process.platform === 'darwin' ? "Hi" : process.platform === 'linux' ? 'Hi' : 'Hi' + const bookmark = {title: 'a title', url: 'test'} clipboard.write({ text: 'test', html: 'Hi', @@ -85,8 +85,8 @@ describe('clipboard module', function () { }) }) - describe('clipboard.read/writeFindText(text)', function () { - it('reads and write text to the find pasteboard', function () { + describe('clipboard.read/writeFindText(text)', () => { + it('reads and write text to the find pasteboard', () => { if (process.platform !== 'darwin') return clipboard.writeFindText('find this') @@ -110,8 +110,8 @@ describe('clipboard module', function () { }) }) - describe('clipboard.readBuffer(format)', function () { - it('returns a Buffer of the content for the specified format', function () { + describe('clipboard.readBuffer(format)', () => { + it('returns a Buffer of the content for the specified format', () => { if (process.platform !== 'darwin') return const buffer = Buffer.from('this is binary', 'utf8') diff --git a/spec/api-crash-reporter-spec.js b/spec/api-crash-reporter-spec.js index b7a50f7c1082..0598677fea26 100644 --- a/spec/api-crash-reporter-spec.js +++ b/spec/api-crash-reporter-spec.js @@ -11,46 +11,42 @@ const {closeWindow} = require('./window-helpers') const {remote} = require('electron') const {app, BrowserWindow, crashReporter} = remote.require('electron') -describe('crashReporter module', function () { - if (process.mas || process.env.DISABLE_CRASH_REPORTER_TESTS) { - return - } +describe('crashReporter module', () => { + if (process.mas || process.env.DISABLE_CRASH_REPORTER_TESTS) return - var originalTempDirectory = null - var tempDirectory = null + let originalTempDirectory = null + let tempDirectory = null - before(function () { + before(() => { tempDirectory = temp.mkdirSync('electronCrashReporterSpec-') originalTempDirectory = app.getPath('temp') app.setPath('temp', tempDirectory) }) - after(function () { + after(() => { app.setPath('temp', originalTempDirectory) }) - var fixtures = path.resolve(__dirname, 'fixtures') + const fixtures = path.resolve(__dirname, 'fixtures') const generateSpecs = (description, browserWindowOpts) => { - describe(description, function () { - var w = null - var stopServer = null + describe(description, () => { + let w = null + let stopServer = null - beforeEach(function () { + beforeEach(() => { stopServer = null w = new BrowserWindow(Object.assign({ show: false }, browserWindowOpts)) }) - afterEach(function () { - return closeWindow(w).then(function () { w = null }) - }) + afterEach(() => closeWindow(w).then(() => { w = null })) - afterEach(function () { + afterEach(() => { stopCrashService() }) - afterEach(function (done) { + afterEach((done) => { if (stopServer != null) { stopServer(done) } else { @@ -123,12 +119,8 @@ describe('crashReporter module', function () { crashReporter.setUploadToServer(false) } const testDone = (uploaded) => { - if (uploaded) { - return done(new Error('Uploaded crash report')) - } - if (process.platform === 'darwin') { - crashReporter.setUploadToServer(true) - } + if (uploaded) return done(new Error('Uploaded crash report')) + if (process.platform === 'darwin') crashReporter.setUploadToServer(true) assert(fs.existsSync(dumpFile)) done() } @@ -136,13 +128,10 @@ describe('crashReporter module', function () { let pollInterval const pollDumpFile = () => { fs.readdir(crashesDir, (err, files) => { - if (err) { - return - } + if (err) return const dumps = files.filter((file) => /\.dmp$/.test(file) && !existingDumpFiles.has(file)) - if (!dumps.length) { - return - } + if (!dumps.length) return + assert.equal(1, dumps.length) dumpFile = path.join(crashesDir, dumps[0]) clearInterval(pollInterval) @@ -210,22 +199,18 @@ describe('crashReporter module', function () { } }) - describe('.start(options)', function () { - it('requires that the companyName and submitURL options be specified', function () { - assert.throws(function () { - crashReporter.start({ - companyName: 'Missing submitURL' - }) + describe('.start(options)', () => { + it('requires that the companyName and submitURL options be specified', () => { + assert.throws(() => { + crashReporter.start({companyName: 'Missing submitURL'}) }, /submitURL is a required option to crashReporter\.start/) - assert.throws(function () { - crashReporter.start({ - submitURL: 'Missing companyName' - }) + assert.throws(() => { + crashReporter.start({submitURL: 'Missing companyName'}) }, /companyName is a required option to crashReporter\.start/) }) - it('can be called multiple times', function () { - assert.doesNotThrow(function () { + it('can be called multiple times', () => { + assert.doesNotThrow(() => { crashReporter.start({ companyName: 'Umbrella Corporation', submitURL: 'http://127.0.0.1/crashes' @@ -239,12 +224,12 @@ describe('crashReporter module', function () { }) }) - describe('.get/setUploadToServer', function () { - it('throws an error when called from the renderer process', function () { + describe('.get/setUploadToServer', () => { + it('throws an error when called from the renderer process', () => { assert.throws(() => require('electron').crashReporter.getUploadToServer()) }) - it('can be read/set from the main process', function () { + it('can be read/set from the main process', () => { if (process.platform === 'darwin') { crashReporter.start({ companyName: 'Umbrella Corporation', @@ -279,9 +264,9 @@ const waitForCrashReport = () => { } const startServer = ({callback, processType, done}) => { - var called = false - var server = http.createServer((req, res) => { - var form = new multiparty.Form() + let called = false + let server = http.createServer((req, res) => { + const form = new multiparty.Form() form.parse(req, (error, fields) => { if (error) throw error if (called) return @@ -335,7 +320,7 @@ const startServer = ({callback, processType, done}) => { for (const connection of activeConnections) { connection.destroy() } - server.close(function () { + server.close(() => { done() }) } diff --git a/spec/api-debugger-spec.js b/spec/api-debugger-spec.js index 83b114f72380..5902a5b0027c 100644 --- a/spec/api-debugger-spec.js +++ b/spec/api-debugger-spec.js @@ -4,11 +4,11 @@ const path = require('path') const {closeWindow} = require('./window-helpers') const BrowserWindow = require('electron').remote.BrowserWindow -describe('debugger module', function () { - var fixtures = path.resolve(__dirname, 'fixtures') - var w = null +describe('debugger module', () => { + const fixtures = path.resolve(__dirname, 'fixtures') + let w = null - beforeEach(function () { + beforeEach(() => { w = new BrowserWindow({ show: false, width: 400, @@ -16,13 +16,11 @@ describe('debugger module', function () { }) }) - afterEach(function () { - return closeWindow(w).then(function () { w = null }) - }) + afterEach(() => closeWindow(w).then(() => { w = null })) - describe('debugger.attach', function () { - it('fails when devtools is already open', function (done) { - w.webContents.on('did-finish-load', function () { + describe('debugger.attach', () => { + it('fails when devtools is already open', (done) => { + w.webContents.on('did-finish-load', () => { w.webContents.openDevTools() try { w.webContents.debugger.attach() @@ -31,10 +29,10 @@ describe('debugger module', function () { done() } }) - w.webContents.loadURL('file://' + path.join(fixtures, 'pages', 'a.html')) + w.webContents.loadURL(`file://${path.join(fixtures, 'pages', 'a.html')}`) }) - it('fails when protocol version is not supported', function (done) { + it('fails when protocol version is not supported', (done) => { try { w.webContents.debugger.attach('2.0') } catch (err) { @@ -43,20 +41,20 @@ describe('debugger module', function () { } }) - it('attaches when no protocol version is specified', function (done) { + it('attaches when no protocol version is specified', (done) => { try { w.webContents.debugger.attach() } catch (err) { - done('unexpected error : ' + err) + done(`unexpected error : ${err}`) } assert(w.webContents.debugger.isAttached()) done() }) }) - describe('debugger.detach', function () { - it('fires detach event', function (done) { - w.webContents.debugger.on('detach', function (e, reason) { + describe('debugger.detach', () => { + it('fires detach event', (done) => { + w.webContents.debugger.on('detach', (e, reason) => { assert.equal(reason, 'target closed') assert(!w.webContents.debugger.isAttached()) done() @@ -64,23 +62,23 @@ describe('debugger module', function () { try { w.webContents.debugger.attach() } catch (err) { - done('unexpected error : ' + err) + done(`unexpected error : ${err}`) } w.webContents.debugger.detach() }) }) - describe('debugger.sendCommand', function () { + describe('debugger.sendCommand', () => { let server - afterEach(function () { + afterEach(() => { if (server != null) { server.close() server = null } }) - it('retuns response', function (done) { + it('retuns response', (done) => { w.webContents.loadURL('about:blank') try { w.webContents.debugger.attach() @@ -100,9 +98,9 @@ describe('debugger module', function () { w.webContents.debugger.sendCommand('Runtime.evaluate', params, callback) }) - it('fires message event', function (done) { - var url = process.platform !== 'win32' - ? 'file://' + path.join(fixtures, 'pages', 'a.html') + it('fires message event', (done) => { + const url = process.platform !== 'win32' + ? `file://${path.join(fixtures, 'pages', 'a.html')}` : 'file:///' + path.join(fixtures, 'pages', 'a.html').replace(/\\/g, '/') w.webContents.loadURL(url) try { @@ -110,7 +108,7 @@ describe('debugger module', function () { } catch (err) { done('unexpected error : ' + err) } - w.webContents.debugger.on('message', function (e, method, params) { + w.webContents.debugger.on('message', (e, method, params) => { if (method === 'Console.messageAdded') { assert.equal(params.message.level, 'log') assert.equal(params.message.url, url) @@ -122,25 +120,25 @@ describe('debugger module', function () { w.webContents.debugger.sendCommand('Console.enable') }) - it('returns error message when command fails', function (done) { + it('returns error message when command fails', (done) => { w.webContents.loadURL('about:blank') try { w.webContents.debugger.attach() } catch (err) { - done('unexpected error : ' + err) + done(`unexpected error : ${err}`) } - w.webContents.debugger.sendCommand('Test', function (err) { + w.webContents.debugger.sendCommand('Test', (err) => { assert.equal(err.message, "'Test' wasn't found") w.webContents.debugger.detach() done() }) }) - it('handles invalid unicode characters in message', function (done) { + it('handles invalid unicode characters in message', (done) => { try { w.webContents.debugger.attach() } catch (err) { - done('unexpected error : ' + err) + done(`unexpected error : ${err}`) } w.webContents.debugger.on('message', (event, method, params) => { diff --git a/spec/api-deprecations-spec.js b/spec/api-deprecations-spec.js index 5b618ac90165..00815b284cb3 100644 --- a/spec/api-deprecations-spec.js +++ b/spec/api-deprecations-spec.js @@ -1,27 +1,26 @@ const assert = require('assert') -const deprecations = require('electron').deprecations +const {deprecations, deprecate} = require('electron') -describe('deprecations', function () { - beforeEach(function () { +describe('deprecations', () => { + beforeEach(() => { deprecations.setHandler(null) process.throwDeprecation = true }) - it('allows a deprecation handler function to be specified', function () { - var messages = [] + it('allows a deprecation handler function to be specified', () => { + const messages = [] - deprecations.setHandler(function (message) { + deprecations.setHandler((message) => { messages.push(message) }) - require('electron').deprecate.log('this is deprecated') - + deprecate.log('this is deprecated') assert.deepEqual(messages, ['this is deprecated']) }) - it('throws an exception if no deprecation handler is specified', function () { - assert.throws(function () { - require('electron').deprecate.log('this is deprecated') + it('throws an exception if no deprecation handler is specified', () => { + assert.throws(() => { + deprecate.log('this is deprecated') }, /this is deprecated/) }) }) diff --git a/spec/api-desktop-capturer-spec.js b/spec/api-desktop-capturer-spec.js index 3dce618de00f..ae4af2375e93 100644 --- a/spec/api-desktop-capturer-spec.js +++ b/spec/api-desktop-capturer-spec.js @@ -1,33 +1,31 @@ const assert = require('assert') -const desktopCapturer = require('electron').desktopCapturer +const {desktopCapturer, remote} = require('electron') -const isCI = require('electron').remote.getGlobal('isCi') +const isCI = remote.getGlobal('isCi') -describe('desktopCapturer', function () { - if (isCI && process.platform === 'win32') { - return - } +describe('desktopCapturer', () => { + if (isCI && process.platform === 'win32') return - it('should return a non-empty array of sources', function (done) { + it('should return a non-empty array of sources', (done) => { desktopCapturer.getSources({ types: ['window', 'screen'] - }, function (error, sources) { + }, (error, sources) => { assert.equal(error, null) assert.notEqual(sources.length, 0) done() }) }) - it('throws an error for invalid options', function (done) { - desktopCapturer.getSources(['window', 'screen'], function (error) { + it('throws an error for invalid options', (done) => { + desktopCapturer.getSources(['window', 'screen'], (error) => { assert.equal(error.message, 'Invalid options') done() }) }) - it('does not throw an error when called more than once (regression)', function (done) { - var callCount = 0 - var callback = function (error, sources) { + it('does not throw an error when called more than once (regression)', (done) => { + let callCount = 0 + const callback = (error, sources) => { callCount++ assert.equal(error, null) assert.notEqual(sources.length, 0) @@ -38,9 +36,9 @@ describe('desktopCapturer', function () { desktopCapturer.getSources({types: ['window', 'screen']}, callback) }) - it('responds to subsequest calls of different options', function (done) { - var callCount = 0 - var callback = function (error, sources) { + it('responds to subsequest calls of different options', (done) => { + let callCount = 0 + const callback = (error, sources) => { callCount++ assert.equal(error, null) if (callCount === 2) done() diff --git a/spec/api-global-shortcut-spec.js b/spec/api-global-shortcut-spec.js index 2031d4556fa6..d6204ace109a 100644 --- a/spec/api-global-shortcut-spec.js +++ b/spec/api-global-shortcut-spec.js @@ -1,12 +1,10 @@ const {globalShortcut} = require('electron').remote -const assert = require('assert') +const assert = require('assert') const isCI = require('electron').remote.getGlobal('isCi') describe('globalShortcut module', () => { - if (isCI && process.platform === 'win32') { - return - } + if (isCI && process.platform === 'win32') return beforeEach(() => { globalShortcut.unregisterAll() diff --git a/spec/api-process-spec.js b/spec/api-process-spec.js index 5f4ad1730bce..954b75eeb2b5 100644 --- a/spec/api-process-spec.js +++ b/spec/api-process-spec.js @@ -1,19 +1,18 @@ const assert = require('assert') -describe('process module', function () { - describe('process.getCPUUsage()', function () { - it('returns a cpu usage object', function () { +describe('process module', () => { + describe('process.getCPUUsage()', () => { + it('returns a cpu usage object', () => { const cpuUsage = process.getCPUUsage() assert.equal(typeof cpuUsage.percentCPUUsage, 'number') assert.equal(typeof cpuUsage.idleWakeupsPerSecond, 'number') }) }) - describe('process.getIOCounters()', function () { - it('returns an io counters object', function () { - if (process.platform === 'darwin') { - return - } + describe('process.getIOCounters()', () => { + it('returns an io counters object', () => { + if (process.platform === 'darwin') return + const ioCounters = process.getIOCounters() assert.equal(typeof ioCounters.readOperationCount, 'number') assert.equal(typeof ioCounters.writeOperationCount, 'number') diff --git a/spec/api-screen-spec.js b/spec/api-screen-spec.js index 93d048acf490..b69a836ec31b 100644 --- a/spec/api-screen-spec.js +++ b/spec/api-screen-spec.js @@ -1,31 +1,29 @@ const assert = require('assert') -const screen = require('electron').screen +const {screen} = require('electron') -describe('screen module', function () { - describe('screen.getCursorScreenPoint()', function () { - it('returns a point object', function () { - var point = screen.getCursorScreenPoint() +describe('screen module', () => { + describe('screen.getCursorScreenPoint()', () => { + it('returns a point object', () => { + const point = screen.getCursorScreenPoint() assert.equal(typeof point.x, 'number') assert.equal(typeof point.y, 'number') }) }) - describe('screen.getPrimaryDisplay()', function () { - it('returns a display object', function () { - var display = screen.getPrimaryDisplay() + describe('screen.getPrimaryDisplay()', () => { + it('returns a display object', () => { + const display = screen.getPrimaryDisplay() assert.equal(typeof display.scaleFactor, 'number') assert(display.size.width > 0) assert(display.size.height > 0) }) }) - describe('screen.getMenuBarHeight()', function () { - if (process.platform !== 'darwin') { - return - } + describe('screen.getMenuBarHeight()', () => { + if (process.platform !== 'darwin') return - it('returns an integer', function () { - var screenHeight = screen.getMenuBarHeight() + it('returns an integer', () => { + const screenHeight = screen.getMenuBarHeight() assert.equal(typeof screenHeight, 'number') }) }) diff --git a/spec/api-system-preferences-spec.js b/spec/api-system-preferences-spec.js index afcb5d1f9e2a..020d6ad5c01c 100644 --- a/spec/api-system-preferences-spec.js +++ b/spec/api-system-preferences-spec.js @@ -2,41 +2,37 @@ const assert = require('assert') const {remote} = require('electron') const {systemPreferences} = remote -describe('systemPreferences module', function () { - describe('systemPreferences.getAccentColor', function () { - if (process.platform !== 'win32') { - return - } +describe('systemPreferences module', () => { + describe('systemPreferences.getAccentColor', () => { + if (process.platform !== 'win32') return - it('should return a non-empty string', function () { + it('should return a non-empty string', () => { let accentColor = systemPreferences.getAccentColor() assert.notEqual(accentColor, null) assert(accentColor.length > 0) }) }) - describe('systemPreferences.getColor(id)', function () { - if (process.platform !== 'win32') { - return - } + describe('systemPreferences.getColor(id)', () => { + if (process.platform !== 'win32') return - it('throws an error when the id is invalid', function () { - assert.throws(function () { + it('throws an error when the id is invalid', () => { + assert.throws(() => { systemPreferences.getColor('not-a-color') }, /Unknown color: not-a-color/) }) - it('returns a hex RGB color string', function () { + it('returns a hex RGB color string', () => { assert.equal(/^#[0-9A-F]{6}$/i.test(systemPreferences.getColor('window')), true) }) }) - describe('systemPreferences.getUserDefault(key, type)', function () { + describe('systemPreferences.getUserDefault(key, type)', () => { if (process.platform !== 'darwin') { return } - it('returns values for known user defaults', function () { + it('returns values for known user defaults', () => { const locale = systemPreferences.getUserDefault('AppleLocale', 'string') assert.equal(typeof locale, 'string') assert(locale.length > 0) @@ -46,7 +42,7 @@ describe('systemPreferences module', function () { assert(languages.length > 0) }) - it('returns values for unknown user defaults', function () { + it('returns values for unknown user defaults', () => { assert.equal(systemPreferences.getUserDefault('UserDefaultDoesNotExist', 'boolean'), false) assert.equal(systemPreferences.getUserDefault('UserDefaultDoesNotExist', 'integer'), 0) assert.equal(systemPreferences.getUserDefault('UserDefaultDoesNotExist', 'float'), 0) @@ -60,12 +56,9 @@ describe('systemPreferences module', function () { }) describe('systemPreferences.setUserDefault(key, type, value)', () => { - if (process.platform !== 'darwin') { - return - } + if (process.platform !== 'darwin') return const KEY = 'SystemPreferencesTest' - const TEST_CASES = [ ['string', 'abc'], ['boolean', true], @@ -101,9 +94,7 @@ describe('systemPreferences module', function () { }) describe('systemPreferences.setUserDefault(key, type, value)', () => { - if (process.platform !== 'darwin') { - return - } + if (process.platform !== 'darwin') return it('removes keys', () => { const KEY = 'SystemPreferencesTest' @@ -117,8 +108,8 @@ describe('systemPreferences module', function () { }) }) - describe('systemPreferences.isInvertedColorScheme()', function () { - it('returns a boolean', function () { + describe('systemPreferences.isInvertedColorScheme()', () => { + it('returns a boolean', () => { assert.equal(typeof systemPreferences.isInvertedColorScheme(), 'boolean') }) }) diff --git a/spec/api-touch-bar-spec.js b/spec/api-touch-bar-spec.js index 6177e3cb85fa..18dd414f688e 100644 --- a/spec/api-touch-bar-spec.js +++ b/spec/api-touch-bar-spec.js @@ -6,22 +6,22 @@ const {closeWindow} = require('./window-helpers') const {TouchBarButton, TouchBarColorPicker, TouchBarGroup} = TouchBar const {TouchBarLabel, TouchBarPopover, TouchBarScrubber, TouchBarSegmentedControl, TouchBarSlider, TouchBarSpacer} = TouchBar -describe('TouchBar module', function () { - it('throws an error when created without an options object', function () { +describe('TouchBar module', () => { + it('throws an error when created without an options object', () => { assert.throws(() => { const touchBar = new TouchBar() touchBar.toString() }, /Must specify options object as first argument/) }) - it('throws an error when created with invalid items', function () { + it('throws an error when created with invalid items', () => { assert.throws(() => { const touchBar = new TouchBar({items: [1, true, {}, []]}) touchBar.toString() }, /Each item must be an instance of TouchBarItem/) }) - it('throws an error when an invalid escape item is set', function () { + it('throws an error when an invalid escape item is set', () => { assert.throws(() => { const touchBar = new TouchBar({items: [], escapeItem: 'esc'}) touchBar.toString() @@ -33,19 +33,19 @@ describe('TouchBar module', function () { }, /Escape item must be an instance of TouchBarItem/) }) - describe('BrowserWindow behavior', function () { + describe('BrowserWindow behavior', () => { let window - beforeEach(function () { + beforeEach(() => { window = new BrowserWindow() }) - afterEach(function () { + afterEach(() => { window.setTouchBar(null) - return closeWindow(window).then(function () { window = null }) + return closeWindow(window).then(() => { window = null }) }) - it('can be added to and removed from a window', function () { + it('can be added to and removed from a window', () => { const label = new TouchBarLabel({label: 'bar'}) const touchBar = new TouchBar([ new TouchBarButton({label: 'foo', backgroundColor: '#F00', click: () => {}}), @@ -73,9 +73,7 @@ describe('TouchBar module', function () { showArrowButtons: true }) ]) - const escapeButton = new TouchBarButton({ - label: 'foo' - }) + const escapeButton = new TouchBarButton({label: 'foo'}) window.setTouchBar(touchBar) touchBar.escapeItem = escapeButton label.label = 'baz' @@ -85,7 +83,7 @@ describe('TouchBar module', function () { touchBar.escapeItem = null }) - it('calls the callback on the items when a window interaction event fires', function (done) { + it('calls the callback on the items when a window interaction event fires', (done) => { const button = new TouchBarButton({ label: 'bar', click: () => { @@ -97,7 +95,7 @@ describe('TouchBar module', function () { window.emit('-touch-bar-interaction', {}, button.id) }) - it('calls the callback on the escape item when a window interaction event fires', function (done) { + it('calls the callback on the escape item when a window interaction event fires', (done) => { const button = new TouchBarButton({ label: 'bar', click: () => {