From b53e41af4236bb7f100ffba2a1d2143844d6b14e Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Thu, 26 Oct 2017 20:05:15 -0400 Subject: [PATCH 1/2] migrate api-browser-view-spec to ES6 --- spec/api-browser-view-spec.js | 52 +++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/spec/api-browser-view-spec.js b/spec/api-browser-view-spec.js index 11cf582b002c..8de4186eafcd 100644 --- a/spec/api-browser-view-spec.js +++ b/spec/api-browser-view-spec.js @@ -6,11 +6,11 @@ const {closeWindow} = require('./window-helpers') const {remote} = require('electron') const {BrowserView, BrowserWindow} = remote -describe('BrowserView module', function () { - var w = null - var view = null +describe.only('BrowserView module', () => { + let w = null + let view = null - beforeEach(function () { + beforeEach(() => { w = new BrowserWindow({ show: false, width: 400, @@ -21,68 +21,68 @@ describe('BrowserView module', function () { }) }) - afterEach(function () { + afterEach(() => { if (view) { view.destroy() view = null } - return closeWindow(w).then(function () { w = null }) + return closeWindow(w).then(() => { w = null }) }) - describe('BrowserView.setBackgroundColor()', function () { - it('does not throw for valid args', function () { + describe('BrowserView.setBackgroundColor()', () => { + it('does not throw for valid args', () => { view = new BrowserView() view.setBackgroundColor('#000') }) - it('throws for invalid args', function () { + it('throws for invalid args', () => { view = new BrowserView() - assert.throws(function () { + assert.throws(() => { view.setBackgroundColor(null) }, /conversion failure/) }) }) - describe('BrowserView.setAutoResize()', function () { - it('does not throw for valid args', function () { + describe('BrowserView.setAutoResize()', () => { + it('does not throw for valid args', () => { view = new BrowserView() view.setAutoResize({}) view.setAutoResize({ width: true, height: false }) }) - it('throws for invalid args', function () { + it('throws for invalid args', () => { view = new BrowserView() - assert.throws(function () { + assert.throws(() => { view.setAutoResize(null) }, /conversion failure/) }) }) - describe('BrowserView.setBounds()', function () { - it('does not throw for valid args', function () { + describe('BrowserView.setBounds()', () => { + it('does not throw for valid args', () => { view = new BrowserView() view.setBounds({ x: 0, y: 0, width: 1, height: 1 }) }) - it('throws for invalid args', function () { + it('throws for invalid args', () => { view = new BrowserView() - assert.throws(function () { + assert.throws(() => { view.setBounds(null) }, /conversion failure/) - assert.throws(function () { + assert.throws(() => { view.setBounds({}) }, /conversion failure/) }) }) - describe('BrowserWindow.setBrowserView()', function () { - it('does not throw for valid args', function () { + describe('BrowserWindow.setBrowserView()', () => { + it('does not throw for valid args', () => { view = new BrowserView() w.setBrowserView(view) }) - it('does not throw if called multiple times with same view', function () { + it('does not throw if called multiple times with same view', () => { view = new BrowserView() w.setBrowserView(view) w.setBrowserView(view) @@ -90,8 +90,8 @@ describe('BrowserView module', function () { }) }) - describe('BrowserView.webContents.getOwnerBrowserWindow()', function () { - it('points to owning window', function () { + describe('BrowserView.webContents.getOwnerBrowserWindow()', () => { + it('points to owning window', () => { view = new BrowserView() assert.ok(!view.webContents.getOwnerBrowserWindow()) w.setBrowserView(view) @@ -101,8 +101,8 @@ describe('BrowserView module', function () { }) }) - describe('BrowserView.fromId()', function () { - it('returns the view with given id', function () { + describe('BrowserView.fromId()', () => { + it('returns the view with given id', () => { view = new BrowserView() w.setBrowserView(view) assert.notEqual(view.id, null) From 68314dbc05ef667e23c7f5a47780920dbef93105 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Thu, 26 Oct 2017 20:11:12 -0400 Subject: [PATCH 2/2] remove stray only --- spec/api-browser-view-spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/api-browser-view-spec.js b/spec/api-browser-view-spec.js index 8de4186eafcd..9e2078ff727e 100644 --- a/spec/api-browser-view-spec.js +++ b/spec/api-browser-view-spec.js @@ -6,7 +6,7 @@ const {closeWindow} = require('./window-helpers') const {remote} = require('electron') const {BrowserView, BrowserWindow} = remote -describe.only('BrowserView module', () => { +describe('BrowserView module', () => { let w = null let view = null