mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: menu bar visibility when exiting full screen (#38683)
* fix:visibility of menu bar when exiting full screen Co-authored-by: wugaosheng <wugaosheng@kylinos.cn> * format code Co-authored-by: wugaosheng <wugaosheng@kylinos.cn> * format code Co-authored-by: wugaosheng <wugaosheng@kylinos.cn> * Modify comments Co-authored-by: wugaosheng <wugaosheng@kylinos.cn> * add menu bar visibility test Co-authored-by: wugaosheng <wugaosheng@kylinos.cn> * format code Co-authored-by: wugaosheng <wugaosheng@kylinos.cn> * change code Co-authored-by: wugaosheng <wugaosheng@kylinos.cn> * platform related in test Co-authored-by: wugaosheng <wugaosheng@kylinos.cn> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: wugaosheng <wugaosheng@kylinos.cn>
This commit is contained in:
@@ -5353,6 +5353,48 @@ describe('BrowserWindow module', () => {
|
||||
});
|
||||
});
|
||||
|
||||
ifdescribe(process.platform !== 'darwin')('when fullscreen state is changed', () => {
|
||||
it('correctly remembers state prior to fullscreen change', async () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
expect(w.isMenuBarVisible()).to.be.true('isMenuBarVisible');
|
||||
w.setMenuBarVisibility(false);
|
||||
expect(w.isMenuBarVisible()).to.be.false('isMenuBarVisible');
|
||||
|
||||
const enterFS = once(w, 'enter-full-screen');
|
||||
w.setFullScreen(true);
|
||||
await enterFS;
|
||||
expect(w.fullScreen).to.be.true('not fullscreen');
|
||||
|
||||
const exitFS = once(w, 'leave-full-screen');
|
||||
w.setFullScreen(false);
|
||||
await exitFS;
|
||||
expect(w.fullScreen).to.be.false('not fullscreen');
|
||||
|
||||
expect(w.isMenuBarVisible()).to.be.false('isMenuBarVisible');
|
||||
});
|
||||
|
||||
it('correctly remembers state prior to fullscreen change with autoHide', async () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
expect(w.autoHideMenuBar).to.be.false('autoHideMenuBar');
|
||||
w.autoHideMenuBar = true;
|
||||
expect(w.autoHideMenuBar).to.be.true('autoHideMenuBar');
|
||||
w.setMenuBarVisibility(false);
|
||||
expect(w.isMenuBarVisible()).to.be.false('isMenuBarVisible');
|
||||
|
||||
const enterFS = once(w, 'enter-full-screen');
|
||||
w.setFullScreen(true);
|
||||
await enterFS;
|
||||
expect(w.fullScreen).to.be.true('not fullscreen');
|
||||
|
||||
const exitFS = once(w, 'leave-full-screen');
|
||||
w.setFullScreen(false);
|
||||
await exitFS;
|
||||
expect(w.fullScreen).to.be.false('not fullscreen');
|
||||
|
||||
expect(w.isMenuBarVisible()).to.be.false('isMenuBarVisible');
|
||||
});
|
||||
});
|
||||
|
||||
ifdescribe(process.platform === 'darwin')('fullscreenable state', () => {
|
||||
it('with functions', () => {
|
||||
it('can be set with fullscreenable constructor option', () => {
|
||||
|
||||
Reference in New Issue
Block a user