Add spec for BrowserWindow.setContentBounds

This commit is contained in:
Kevin Sawicki 2016-08-04 12:34:09 -07:00
parent 01f95c149a
commit 3041fcc79e

View file

@ -332,25 +332,42 @@ describe('browser-window module', function () {
var after = w.getContentSize() var after = w.getContentSize()
assert.equal(after[0], size[0]) assert.equal(after[0], size[0])
assert.equal(after[1], size[1]) assert.equal(after[1], size[1])
assert.equal(w.getContentBounds().width, size[0])
assert.equal(w.getContentBounds().height, size[1])
}) })
it('works for framless window', function () { it('works for a frameless window', function () {
w.destroy() w.destroy()
w = new BrowserWindow({ w = new BrowserWindow({
show: false, show: false,
frame: false, frame: false,
width: 400, width: 300,
height: 400 height: 300
}) })
var size = [400, 400] var size = [400, 400]
w.setContentSize(size[0], size[1]) w.setContentSize(size[0], size[1])
var after = w.getContentSize() var after = w.getContentSize()
assert.equal(after[0], size[0]) assert.equal(after[0], size[0])
assert.equal(after[1], size[1]) assert.equal(after[1], size[1])
assert.equal(w.getContentBounds().width, size[0]) })
assert.equal(w.getContentBounds().height, size[1]) })
describe('BrowserWindow.setContentBounds(bounds)', function () {
it('sets the content size and position', function () {
var bounds = {x: 100, y: 100, width: 400, height: 400}
w.setContentBounds(bounds)
assert.deepEqual(w.getContentBounds(), bounds)
})
it('works for a frameless window', function () {
w.destroy()
w = new BrowserWindow({
show: false,
frame: false,
width: 300,
height: 300
})
var bounds = {x: 100, y: 100, width: 400, height: 400}
w.setContentBounds(bounds)
assert.deepEqual(w.getContentBounds(), bounds)
}) })
}) })
@ -396,7 +413,7 @@ describe('browser-window module', function () {
assert.equal(size[1], 400) assert.equal(size[1], 400)
}) })
it('works for framless window', function () { it('works for a frameless window', function () {
w.destroy() w.destroy()
w = new BrowserWindow({ w = new BrowserWindow({
show: false, show: false,