feat: allow partial setting of window bounds (#15677)

Extend the existing win.setBounds functionality by allowing developers to partially update bounds without being forced to pass in all four bounds values. No existing functionality is altere
This commit is contained in:
Shelley Vohr 2018-11-12 15:31:14 -05:00 committed by GitHub
parent 0c46a7a4d9
commit c06f023313
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 1 deletions

View file

@ -524,6 +524,26 @@ describe('BrowserWindow module', () => {
})
})
describe('BrowserWindow.setBounds(bounds[, animate])', () => {
it('sets the window bounds with full bounds', () => {
const fullBounds = { x: 440, y: 225, width: 500, height: 400 }
w.setBounds(fullBounds)
assertBoundsEqual(w.getBounds(), fullBounds)
})
it('sets the window bounds with partial bounds', () => {
const fullBounds = { x: 440, y: 225, width: 500, height: 400 }
w.setBounds(fullBounds)
const boundsUpdate = { width: 100 }
w.setBounds(boundsUpdate)
const expectedBounds = Object.assign(fullBounds, boundsUpdate)
assertBoundsEqual(w.getBounds(), expectedBounds)
})
})
describe('BrowserWindow.setSize(width, height)', () => {
it('sets the window size', async () => {
const size = [300, 400]