electron/spec-main/fixtures/api/test-menu-visibility/main.js

20 lines
507 B
JavaScript
Raw Normal View History

2020-03-20 20:28:31 +00:00
const { app, BrowserWindow } = require('electron');
2020-03-20 20:28:31 +00:00
let win;
// This test uses "app.once('ready')" while the |test-menu-null| test uses
// "app.whenReady()", the 2 APIs have slight difference on timing to cover
// more cases.
app.once('ready', function () {
2020-03-20 20:28:31 +00:00
win = new BrowserWindow({});
win.setMenuBarVisibility(false);
setTimeout(() => {
if (win.isMenuBarVisible()) {
2020-03-20 20:28:31 +00:00
console.log('Window has a menu');
} else {
2020-03-20 20:28:31 +00:00
console.log('Window has no menu');
}
2020-03-20 20:28:31 +00:00
app.quit();
});
});