Skip to content

Commit 3041fcc

Browse files
committed
Add spec for BrowserWindow.setContentBounds
1 parent 01f95c1 commit 3041fcc

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

spec/api-browser-window-spec.js

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -332,25 +332,42 @@ describe('browser-window module', function () {
332332
var after = w.getContentSize()
333333
assert.equal(after[0], size[0])
334334
assert.equal(after[1], size[1])
335-
assert.equal(w.getContentBounds().width, size[0])
336-
assert.equal(w.getContentBounds().height, size[1])
337335
})
338336

339-
it('works for framless window', function () {
337+
it('works for a frameless window', function () {
340338
w.destroy()
341339
w = new BrowserWindow({
342340
show: false,
343341
frame: false,
344-
width: 400,
345-
height: 400
342+
width: 300,
343+
height: 300
346344
})
347345
var size = [400, 400]
348346
w.setContentSize(size[0], size[1])
349347
var after = w.getContentSize()
350348
assert.equal(after[0], size[0])
351349
assert.equal(after[1], size[1])
352-
assert.equal(w.getContentBounds().width, size[0])
353-
assert.equal(w.getContentBounds().height, size[1])
350+
})
351+
})
352+
353+
describe('BrowserWindow.setContentBounds(bounds)', function () {
354+
it('sets the content size and position', function () {
355+
var bounds = {x: 100, y: 100, width: 400, height: 400}
356+
w.setContentBounds(bounds)
357+
assert.deepEqual(w.getContentBounds(), bounds)
358+
})
359+
360+
it('works for a frameless window', function () {
361+
w.destroy()
362+
w = new BrowserWindow({
363+
show: false,
364+
frame: false,
365+
width: 300,
366+
height: 300
367+
})
368+
var bounds = {x: 100, y: 100, width: 400, height: 400}
369+
w.setContentBounds(bounds)
370+
assert.deepEqual(w.getContentBounds(), bounds)
354371
})
355372
})
356373

@@ -396,7 +413,7 @@ describe('browser-window module', function () {
396413
assert.equal(size[1], 400)
397414
})
398415

399-
it('works for framless window', function () {
416+
it('works for a frameless window', function () {
400417
w.destroy()
401418
w = new BrowserWindow({
402419
show: false,

0 commit comments

Comments
 (0)