migrate api-browser-view-spec to ES6
This commit is contained in:
parent
166fb476a3
commit
b53e41af42
1 changed files with 26 additions and 26 deletions
|
@ -6,11 +6,11 @@ const {closeWindow} = require('./window-helpers')
|
||||||
const {remote} = require('electron')
|
const {remote} = require('electron')
|
||||||
const {BrowserView, BrowserWindow} = remote
|
const {BrowserView, BrowserWindow} = remote
|
||||||
|
|
||||||
describe('BrowserView module', function () {
|
describe.only('BrowserView module', () => {
|
||||||
var w = null
|
let w = null
|
||||||
var view = null
|
let view = null
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(() => {
|
||||||
w = new BrowserWindow({
|
w = new BrowserWindow({
|
||||||
show: false,
|
show: false,
|
||||||
width: 400,
|
width: 400,
|
||||||
|
@ -21,68 +21,68 @@ describe('BrowserView module', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(() => {
|
||||||
if (view) {
|
if (view) {
|
||||||
view.destroy()
|
view.destroy()
|
||||||
view = null
|
view = null
|
||||||
}
|
}
|
||||||
|
|
||||||
return closeWindow(w).then(function () { w = null })
|
return closeWindow(w).then(() => { w = null })
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('BrowserView.setBackgroundColor()', function () {
|
describe('BrowserView.setBackgroundColor()', () => {
|
||||||
it('does not throw for valid args', function () {
|
it('does not throw for valid args', () => {
|
||||||
view = new BrowserView()
|
view = new BrowserView()
|
||||||
view.setBackgroundColor('#000')
|
view.setBackgroundColor('#000')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('throws for invalid args', function () {
|
it('throws for invalid args', () => {
|
||||||
view = new BrowserView()
|
view = new BrowserView()
|
||||||
assert.throws(function () {
|
assert.throws(() => {
|
||||||
view.setBackgroundColor(null)
|
view.setBackgroundColor(null)
|
||||||
}, /conversion failure/)
|
}, /conversion failure/)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('BrowserView.setAutoResize()', function () {
|
describe('BrowserView.setAutoResize()', () => {
|
||||||
it('does not throw for valid args', function () {
|
it('does not throw for valid args', () => {
|
||||||
view = new BrowserView()
|
view = new BrowserView()
|
||||||
view.setAutoResize({})
|
view.setAutoResize({})
|
||||||
view.setAutoResize({ width: true, height: false })
|
view.setAutoResize({ width: true, height: false })
|
||||||
})
|
})
|
||||||
|
|
||||||
it('throws for invalid args', function () {
|
it('throws for invalid args', () => {
|
||||||
view = new BrowserView()
|
view = new BrowserView()
|
||||||
assert.throws(function () {
|
assert.throws(() => {
|
||||||
view.setAutoResize(null)
|
view.setAutoResize(null)
|
||||||
}, /conversion failure/)
|
}, /conversion failure/)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('BrowserView.setBounds()', function () {
|
describe('BrowserView.setBounds()', () => {
|
||||||
it('does not throw for valid args', function () {
|
it('does not throw for valid args', () => {
|
||||||
view = new BrowserView()
|
view = new BrowserView()
|
||||||
view.setBounds({ x: 0, y: 0, width: 1, height: 1 })
|
view.setBounds({ x: 0, y: 0, width: 1, height: 1 })
|
||||||
})
|
})
|
||||||
|
|
||||||
it('throws for invalid args', function () {
|
it('throws for invalid args', () => {
|
||||||
view = new BrowserView()
|
view = new BrowserView()
|
||||||
assert.throws(function () {
|
assert.throws(() => {
|
||||||
view.setBounds(null)
|
view.setBounds(null)
|
||||||
}, /conversion failure/)
|
}, /conversion failure/)
|
||||||
assert.throws(function () {
|
assert.throws(() => {
|
||||||
view.setBounds({})
|
view.setBounds({})
|
||||||
}, /conversion failure/)
|
}, /conversion failure/)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('BrowserWindow.setBrowserView()', function () {
|
describe('BrowserWindow.setBrowserView()', () => {
|
||||||
it('does not throw for valid args', function () {
|
it('does not throw for valid args', () => {
|
||||||
view = new BrowserView()
|
view = new BrowserView()
|
||||||
w.setBrowserView(view)
|
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()
|
view = new BrowserView()
|
||||||
w.setBrowserView(view)
|
w.setBrowserView(view)
|
||||||
w.setBrowserView(view)
|
w.setBrowserView(view)
|
||||||
|
@ -90,8 +90,8 @@ describe('BrowserView module', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('BrowserView.webContents.getOwnerBrowserWindow()', function () {
|
describe('BrowserView.webContents.getOwnerBrowserWindow()', () => {
|
||||||
it('points to owning window', function () {
|
it('points to owning window', () => {
|
||||||
view = new BrowserView()
|
view = new BrowserView()
|
||||||
assert.ok(!view.webContents.getOwnerBrowserWindow())
|
assert.ok(!view.webContents.getOwnerBrowserWindow())
|
||||||
w.setBrowserView(view)
|
w.setBrowserView(view)
|
||||||
|
@ -101,8 +101,8 @@ describe('BrowserView module', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('BrowserView.fromId()', function () {
|
describe('BrowserView.fromId()', () => {
|
||||||
it('returns the view with given id', function () {
|
it('returns the view with given id', () => {
|
||||||
view = new BrowserView()
|
view = new BrowserView()
|
||||||
w.setBrowserView(view)
|
w.setBrowserView(view)
|
||||||
assert.notEqual(view.id, null)
|
assert.notEqual(view.id, null)
|
||||||
|
|
Loading…
Reference in a new issue