feat: Add BrowserWindow.setWindowButtonVisibility()
Fixes #12701 and supersedes #13131. Ideally we would have added `setTitleBarStyle()`, but that is a significantly more involved change. For example, consider the case where we switch from `hidden` to `normal`. We would not only have to show the traffic light buttons, we would also have to switch the window from a frameless to a framed window and deal with various other window state. Lets instead implement a simple solution for #12701.
This commit is contained in:
parent
00c0c180ab
commit
a42ca9eecc
8 changed files with 82 additions and 7 deletions
|
@ -765,6 +765,33 @@ describe('BrowserWindow module', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe('BrowserWindow.setWindowButtonVisibility()', () => {
|
||||
before(function () {
|
||||
if (process.platform !== 'darwin') {
|
||||
this.skip()
|
||||
}
|
||||
})
|
||||
|
||||
it('does not throw', () => {
|
||||
assert.doesNotThrow(() => {
|
||||
w.setWindowButtonVisibility(true)
|
||||
w.setWindowButtonVisibility(false)
|
||||
})
|
||||
})
|
||||
|
||||
it('throws with custom title bar buttons', () => {
|
||||
assert.throws(() => {
|
||||
w.destroy()
|
||||
w = new BrowserWindow({
|
||||
show: false,
|
||||
titleBarStyle: 'customButtonsOnHover',
|
||||
frame: false
|
||||
})
|
||||
w.setWindowButtonVisibility(true)
|
||||
}, /Not supported for this window/)
|
||||
})
|
||||
})
|
||||
|
||||
describe('BrowserWindow.setVibrancy(type)', () => {
|
||||
it('allows setting, changing, and removing the vibrancy', () => {
|
||||
assert.doesNotThrow(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue