Skip to content

Commit 3a0ceb4

Browse files
committed
Assert new content bounds after resize event
1 parent 3041fcc commit 3a0ceb4

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

spec/api-browser-window-spec.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ describe('browser-window module', function () {
339339
w = new BrowserWindow({
340340
show: false,
341341
frame: false,
342-
width: 300,
343-
height: 300
342+
width: 400,
343+
height: 400
344344
})
345345
var size = [400, 400]
346346
w.setContentSize(size[0], size[1])
@@ -351,23 +351,29 @@ describe('browser-window module', function () {
351351
})
352352

353353
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}
354+
it('sets the content size and position', function (done) {
355+
var bounds = {x: 60, y: 60, width: 250, height: 250}
356+
w.once('resize', function () {
357+
assert.deepEqual(w.getContentBounds(), bounds)
358+
done()
359+
})
356360
w.setContentBounds(bounds)
357-
assert.deepEqual(w.getContentBounds(), bounds)
358361
})
359362

360-
it('works for a frameless window', function () {
363+
it('works for a frameless window', function (done) {
361364
w.destroy()
362365
w = new BrowserWindow({
363366
show: false,
364367
frame: false,
365368
width: 300,
366369
height: 300
367370
})
368-
var bounds = {x: 100, y: 100, width: 400, height: 400}
371+
var bounds = {x: 60, y: 60, width: 250, height: 250}
372+
w.once('resize', function () {
373+
assert.deepEqual(w.getContentBounds(), bounds)
374+
done()
375+
})
369376
w.setContentBounds(bounds)
370-
assert.deepEqual(w.getContentBounds(), bounds)
371377
})
372378
})
373379

0 commit comments

Comments
 (0)