зеркало из https://github.com/electron/electron.git
Assert new content bounds after resize event
This commit is contained in:
Родитель
3041fcc79e
Коммит
3a0ceb40b9
|
@ -339,8 +339,8 @@ describe('browser-window module', function () {
|
||||||
w = new BrowserWindow({
|
w = new BrowserWindow({
|
||||||
show: false,
|
show: false,
|
||||||
frame: false,
|
frame: false,
|
||||||
width: 300,
|
width: 400,
|
||||||
height: 300
|
height: 400
|
||||||
})
|
})
|
||||||
var size = [400, 400]
|
var size = [400, 400]
|
||||||
w.setContentSize(size[0], size[1])
|
w.setContentSize(size[0], size[1])
|
||||||
|
@ -351,13 +351,16 @@ describe('browser-window module', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('BrowserWindow.setContentBounds(bounds)', function () {
|
describe('BrowserWindow.setContentBounds(bounds)', function () {
|
||||||
it('sets the content size and position', function () {
|
it('sets the content size and position', function (done) {
|
||||||
var bounds = {x: 100, y: 100, width: 400, height: 400}
|
var bounds = {x: 60, y: 60, width: 250, height: 250}
|
||||||
|
w.once('resize', function () {
|
||||||
|
assert.deepEqual(w.getContentBounds(), bounds)
|
||||||
|
done()
|
||||||
|
})
|
||||||
w.setContentBounds(bounds)
|
w.setContentBounds(bounds)
|
||||||
assert.deepEqual(w.getContentBounds(), bounds)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('works for a frameless window', function () {
|
it('works for a frameless window', function (done) {
|
||||||
w.destroy()
|
w.destroy()
|
||||||
w = new BrowserWindow({
|
w = new BrowserWindow({
|
||||||
show: false,
|
show: false,
|
||||||
|
@ -365,9 +368,12 @@ describe('browser-window module', function () {
|
||||||
width: 300,
|
width: 300,
|
||||||
height: 300
|
height: 300
|
||||||
})
|
})
|
||||||
var bounds = {x: 100, y: 100, width: 400, height: 400}
|
var bounds = {x: 60, y: 60, width: 250, height: 250}
|
||||||
|
w.once('resize', function () {
|
||||||
|
assert.deepEqual(w.getContentBounds(), bounds)
|
||||||
|
done()
|
||||||
|
})
|
||||||
w.setContentBounds(bounds)
|
w.setContentBounds(bounds)
|
||||||
assert.deepEqual(w.getContentBounds(), bounds)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче