fix: make SetWindowButtonVisibility work for customButtonsOnHover (#27073)
This commit is contained in:
parent
5e7e0a4c7e
commit
c3091c3a70
9 changed files with 87 additions and 52 deletions
|
@ -1517,15 +1517,40 @@ describe('BrowserWindow module', () => {
|
|||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('throws with custom title bar buttons', () => {
|
||||
expect(() => {
|
||||
const w = new BrowserWindow({
|
||||
show: false,
|
||||
titleBarStyle: 'customButtonsOnHover',
|
||||
frame: false
|
||||
});
|
||||
w.setWindowButtonVisibility(true);
|
||||
}).to.throw('Not supported for this window');
|
||||
it('changes window button visibility for normal window', () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
expect(w._getWindowButtonVisibility()).to.equal(true);
|
||||
w.setWindowButtonVisibility(false);
|
||||
expect(w._getWindowButtonVisibility()).to.equal(false);
|
||||
w.setWindowButtonVisibility(true);
|
||||
expect(w._getWindowButtonVisibility()).to.equal(true);
|
||||
});
|
||||
|
||||
it('changes window button visibility for frameless window', () => {
|
||||
const w = new BrowserWindow({ show: false, frame: false });
|
||||
expect(w._getWindowButtonVisibility()).to.equal(false);
|
||||
w.setWindowButtonVisibility(true);
|
||||
expect(w._getWindowButtonVisibility()).to.equal(true);
|
||||
w.setWindowButtonVisibility(false);
|
||||
expect(w._getWindowButtonVisibility()).to.equal(false);
|
||||
});
|
||||
|
||||
it('changes window button visibility for hiddenInset window', () => {
|
||||
const w = new BrowserWindow({ show: false, frame: false, titleBarStyle: 'hiddenInset' });
|
||||
expect(w._getWindowButtonVisibility()).to.equal(true);
|
||||
w.setWindowButtonVisibility(false);
|
||||
expect(w._getWindowButtonVisibility()).to.equal(false);
|
||||
w.setWindowButtonVisibility(true);
|
||||
expect(w._getWindowButtonVisibility()).to.equal(true);
|
||||
});
|
||||
|
||||
it('changes window button visibility for customButtonsOnHover window', () => {
|
||||
const w = new BrowserWindow({ show: false, frame: false, titleBarStyle: 'customButtonsOnHover' });
|
||||
expect(w._getWindowButtonVisibility()).to.equal(true);
|
||||
w.setWindowButtonVisibility(false);
|
||||
expect(w._getWindowButtonVisibility()).to.equal(false);
|
||||
w.setWindowButtonVisibility(true);
|
||||
expect(w._getWindowButtonVisibility()).to.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue