|
@@ -943,8 +943,9 @@ describe('BrowserWindow module', () => {
|
|
|
w.setPosition(pos[0], pos[1]);
|
|
|
});
|
|
|
});
|
|
|
- ifdescribe(process.platform !== 'linux')(`Maximized state`, () => {
|
|
|
- it(`checks normal bounds when maximized`, (done) => {
|
|
|
+
|
|
|
+ ifdescribe(process.platform !== 'linux')('Maximized state', () => {
|
|
|
+ it('checks normal bounds when maximized', (done) => {
|
|
|
const bounds = w.getBounds();
|
|
|
w.once('maximize', () => {
|
|
|
expectBoundsEqual(w.getNormalBounds(), bounds);
|
|
@@ -966,8 +967,9 @@ describe('BrowserWindow module', () => {
|
|
|
w.maximize();
|
|
|
});
|
|
|
});
|
|
|
- ifdescribe(process.platform !== 'linux')(`Minimized state`, () => {
|
|
|
- it(`checks normal bounds when minimized`, (done) => {
|
|
|
+
|
|
|
+ ifdescribe(process.platform !== 'linux')('Minimized state', () => {
|
|
|
+ it('checks normal bounds when minimized', (done) => {
|
|
|
const bounds = w.getBounds();
|
|
|
w.once('minimize', () => {
|
|
|
expectBoundsEqual(w.getNormalBounds(), bounds);
|
|
@@ -989,6 +991,7 @@ describe('BrowserWindow module', () => {
|
|
|
w.minimize();
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
ifdescribe(process.platform === 'win32')(`Fullscreen state`, () => {
|
|
|
it(`checks normal bounds when fullscreen'ed`, (done) => {
|
|
|
const bounds = w.getBounds();
|
|
@@ -999,6 +1002,7 @@ describe('BrowserWindow module', () => {
|
|
|
w.show();
|
|
|
w.setFullScreen(true);
|
|
|
});
|
|
|
+
|
|
|
it(`checks normal bounds when unfullscreen'ed`, (done) => {
|
|
|
const bounds = w.getBounds();
|
|
|
w.once('enter-full-screen', () => {
|
|
@@ -3403,6 +3407,96 @@ describe('BrowserWindow module', () => {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ describe('visibleOnAllWorkspaces state', () => {
|
|
|
+ it('with properties', () => {
|
|
|
+ it('can be changed', () => {
|
|
|
+ const w = new BrowserWindow({ show: false });
|
|
|
+ expect(w.visibleOnAllWorkspaces).to.be.false();
|
|
|
+ w.visibleOnAllWorkspaces = true;
|
|
|
+ expect(w.visibleOnAllWorkspaces).to.be.true();
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('with functions', () => {
|
|
|
+ it('can be changed', () => {
|
|
|
+ const w = new BrowserWindow({ show: false });
|
|
|
+ expect(w.isVisibleOnAllWorkspaces()).to.be.false();
|
|
|
+ w.setVisibleOnAllWorkspaces(true);
|
|
|
+ expect(w.isVisibleOnAllWorkspaces()).to.be.true();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ ifdescribe(process.platform === 'darwin')('documentEdited state', () => {
|
|
|
+ it('with properties', () => {
|
|
|
+ it('can be changed', () => {
|
|
|
+ const w = new BrowserWindow({ show: false });
|
|
|
+ expect(w.documentEdited).to.be.false();
|
|
|
+ w.documentEdited = true;
|
|
|
+ expect(w.documentEdited).to.be.true();
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('with functions', () => {
|
|
|
+ it('can be changed', () => {
|
|
|
+ const w = new BrowserWindow({ show: false });
|
|
|
+ expect(w.isDocumentEdited()).to.be.false();
|
|
|
+ w.setDocumentEdited(true);
|
|
|
+ expect(w.isDocumentEdited()).to.be.true();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ ifdescribe(process.platform === 'darwin')('representedFilename', () => {
|
|
|
+ it('with properties', () => {
|
|
|
+ it('can be changed', () => {
|
|
|
+ const w = new BrowserWindow({ show: false });
|
|
|
+ expect(w.representedFilename).to.eql('');
|
|
|
+ w.representedFilename = 'a name';
|
|
|
+ expect(w.representedFilename).to.eql('a name');
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('with functions', () => {
|
|
|
+ it('can be changed', () => {
|
|
|
+ const w = new BrowserWindow({ show: false });
|
|
|
+ expect(w.getRepresentedFilename()).to.eql('');
|
|
|
+ w.setRepresentedFilename('a name');
|
|
|
+ expect(w.getRepresentedFilename()).to.eql('a name');
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ describe('native window title', () => {
|
|
|
+ it('with properties', () => {
|
|
|
+ it('can be set with title constructor option', () => {
|
|
|
+ const w = new BrowserWindow({ show: false, title: 'mYtItLe' });
|
|
|
+ expect(w.title).to.eql('mYtItLe');
|
|
|
+ });
|
|
|
+
|
|
|
+ it('can be changed', () => {
|
|
|
+ const w = new BrowserWindow({ show: false });
|
|
|
+ expect(w.title).to.eql('Electron Test Main');
|
|
|
+ w.title = 'NEW TITLE';
|
|
|
+ expect(w.title).to.eql('NEW TITLE');
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('with functions', () => {
|
|
|
+ it('can be set with minimizable constructor option', () => {
|
|
|
+ const w = new BrowserWindow({ show: false, title: 'mYtItLe' });
|
|
|
+ expect(w.getTitle()).to.eql('mYtItLe');
|
|
|
+ });
|
|
|
+
|
|
|
+ it('can be changed', () => {
|
|
|
+ const w = new BrowserWindow({ show: false });
|
|
|
+ expect(w.getTitle()).to.eql('Electron Test Main');
|
|
|
+ w.setTitle('NEW TITLE');
|
|
|
+ expect(w.getTitle()).to.eql('NEW TITLE');
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
describe('minimizable state', () => {
|
|
|
it('with properties', () => {
|
|
|
it('can be set with minimizable constructor option', () => {
|
|
@@ -3535,23 +3629,31 @@ describe('BrowserWindow module', () => {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- ifdescribe(process.platform === 'darwin')('fullscreenable state', () => {
|
|
|
- it('with properties', () => {
|
|
|
- it('can be set with fullscreenable constructor option', () => {
|
|
|
- const w = new BrowserWindow({ show: false, fullscreenable: false });
|
|
|
- expect(w.fullScreenable).to.be.false('fullScreenable');
|
|
|
+ ifdescribe(process.platform !== 'darwin')('menuBarVisible state', () => {
|
|
|
+ describe('with properties', () => {
|
|
|
+ it('can be changed', () => {
|
|
|
+ const w = new BrowserWindow({ show: false });
|
|
|
+ expect(w.menuBarVisible).to.be.true();
|
|
|
+ w.menuBarVisible = false;
|
|
|
+ expect(w.menuBarVisible).to.be.false();
|
|
|
+ w.menuBarVisible = true;
|
|
|
+ expect(w.menuBarVisible).to.be.true();
|
|
|
});
|
|
|
+ });
|
|
|
|
|
|
+ describe('with functions', () => {
|
|
|
it('can be changed', () => {
|
|
|
const w = new BrowserWindow({ show: false });
|
|
|
- expect(w.fullScreenable).to.be.true('fullScreenable');
|
|
|
- w.fullScreenable = false;
|
|
|
- expect(w.fullScreenable).to.be.false('fullScreenable');
|
|
|
- w.fullScreenable = true;
|
|
|
- expect(w.fullScreenable).to.be.true('fullScreenable');
|
|
|
+ expect(w.isMenuBarVisible()).to.be.true('isMenuBarVisible');
|
|
|
+ w.setMenuBarVisibility(false);
|
|
|
+ expect(w.isMenuBarVisible()).to.be.false('isMenuBarVisible');
|
|
|
+ w.setMenuBarVisibility(true);
|
|
|
+ expect(w.isMenuBarVisible()).to.be.true('isMenuBarVisible');
|
|
|
});
|
|
|
});
|
|
|
+ });
|
|
|
|
|
|
+ ifdescribe(process.platform === 'darwin')('fullscreenable state', () => {
|
|
|
it('with functions', () => {
|
|
|
it('can be set with fullscreenable constructor option', () => {
|
|
|
const w = new BrowserWindow({ show: false, fullscreenable: false });
|
|
@@ -3573,18 +3675,46 @@ describe('BrowserWindow module', () => {
|
|
|
const tick = () => new Promise(resolve => setTimeout(resolve));
|
|
|
|
|
|
ifdescribe(process.platform === 'darwin')('kiosk state', () => {
|
|
|
- it('can be changed with setKiosk method', (done) => {
|
|
|
- const w = new BrowserWindow();
|
|
|
- w.once('enter-full-screen', async () => {
|
|
|
- await tick();
|
|
|
- w.setKiosk(false);
|
|
|
- expect(w.isKiosk()).to.be.false('isKiosk');
|
|
|
+ it('with properties', () => {
|
|
|
+ it('can be set with a constructor property', () => {
|
|
|
+ const w = new BrowserWindow({ kiosk: true });
|
|
|
+ expect(w.kiosk).to.be.true();
|
|
|
});
|
|
|
- w.once('leave-full-screen', () => {
|
|
|
- done();
|
|
|
+
|
|
|
+ it('can be changed ', (done) => {
|
|
|
+ const w = new BrowserWindow();
|
|
|
+ w.once('enter-full-screen', async () => {
|
|
|
+ await tick();
|
|
|
+ w.kiosk = false;
|
|
|
+ expect(w.kiosk).to.be.false();
|
|
|
+ });
|
|
|
+ w.once('leave-full-screen', () => {
|
|
|
+ done();
|
|
|
+ });
|
|
|
+ w.kiosk = true;
|
|
|
+ expect(w.kiosk).to.be.true();
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('with functions', () => {
|
|
|
+ it('can be set with a constructor property', () => {
|
|
|
+ const w = new BrowserWindow({ kiosk: true });
|
|
|
+ expect(w.isKiosk()).to.be.true();
|
|
|
+ });
|
|
|
+
|
|
|
+ it('can be changed ', (done) => {
|
|
|
+ const w = new BrowserWindow();
|
|
|
+ w.once('enter-full-screen', async () => {
|
|
|
+ await tick();
|
|
|
+ w.setKiosk(false);
|
|
|
+ expect(w.isKiosk()).to.be.false('isKiosk');
|
|
|
+ });
|
|
|
+ w.once('leave-full-screen', () => {
|
|
|
+ done();
|
|
|
+ });
|
|
|
+ w.setKiosk(true);
|
|
|
+ expect(w.isKiosk()).to.be.true('isKiosk');
|
|
|
});
|
|
|
- w.setKiosk(true);
|
|
|
- expect(w.isKiosk()).to.be.true('isKiosk');
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -3619,7 +3749,7 @@ describe('BrowserWindow module', () => {
|
|
|
w.setFullScreen(true);
|
|
|
});
|
|
|
|
|
|
- it('does not crash when exiting simpleFullScreen', (done) => {
|
|
|
+ it('does not crash when exiting simpleFullScreen (properties)', (done) => {
|
|
|
const w = new BrowserWindow();
|
|
|
w.setSimpleFullScreen(true);
|
|
|
|
|
@@ -3629,6 +3759,16 @@ describe('BrowserWindow module', () => {
|
|
|
}, 1000);
|
|
|
});
|
|
|
|
|
|
+ it('does not crash when exiting simpleFullScreen (functions)', (done) => {
|
|
|
+ const w = new BrowserWindow();
|
|
|
+ w.simpleFullScreen = true;
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ w.setFullScreen(!w.isFullScreen());
|
|
|
+ done();
|
|
|
+ }, 1000);
|
|
|
+ });
|
|
|
+
|
|
|
it('should not be changed by setKiosk method', (done) => {
|
|
|
const w = new BrowserWindow();
|
|
|
w.once('enter-full-screen', async () => {
|
|
@@ -3683,27 +3823,53 @@ describe('BrowserWindow module', () => {
|
|
|
});
|
|
|
|
|
|
describe('hasShadow state', () => {
|
|
|
- it('returns a boolean on all platforms', () => {
|
|
|
- const w = new BrowserWindow({ show: false });
|
|
|
- const hasShadow = w.hasShadow();
|
|
|
- expect(hasShadow).to.be.a('boolean');
|
|
|
- });
|
|
|
+ it('with properties', () => {
|
|
|
+ it('returns a boolean on all platforms', () => {
|
|
|
+ const w = new BrowserWindow({ show: false });
|
|
|
+ expect(w.shadow).to.be.a('boolean');
|
|
|
+ });
|
|
|
+
|
|
|
+ // On Windows there's no shadow by default & it can't be changed dynamically.
|
|
|
+ it('can be changed with hasShadow option', () => {
|
|
|
+ const hasShadow = process.platform !== 'darwin';
|
|
|
+ const w = new BrowserWindow({ show: false, hasShadow });
|
|
|
+ expect(w.shadow).to.equal(hasShadow);
|
|
|
+ });
|
|
|
|
|
|
- // On Windows there's no shadow by default & it can't be changed dynamically.
|
|
|
- it('can be changed with hasShadow option', () => {
|
|
|
- const hasShadow = process.platform !== 'darwin';
|
|
|
- const w = new BrowserWindow({ show: false, hasShadow });
|
|
|
- expect(w.hasShadow()).to.equal(hasShadow);
|
|
|
+ it('can be changed with setHasShadow method', () => {
|
|
|
+ const w = new BrowserWindow({ show: false });
|
|
|
+ w.shadow = false;
|
|
|
+ expect(w.shadow).to.be.false('hasShadow');
|
|
|
+ w.shadow = true;
|
|
|
+ expect(w.shadow).to.be.true('hasShadow');
|
|
|
+ w.shadow = false;
|
|
|
+ expect(w.shadow).to.be.false('hasShadow');
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
- it('can be changed with setHasShadow method', () => {
|
|
|
- const w = new BrowserWindow({ show: false });
|
|
|
- w.setHasShadow(false);
|
|
|
- expect(w.hasShadow()).to.be.false('hasShadow');
|
|
|
- w.setHasShadow(true);
|
|
|
- expect(w.hasShadow()).to.be.true('hasShadow');
|
|
|
- w.setHasShadow(false);
|
|
|
- expect(w.hasShadow()).to.be.false('hasShadow');
|
|
|
+ describe('with functions', () => {
|
|
|
+ it('returns a boolean on all platforms', () => {
|
|
|
+ const w = new BrowserWindow({ show: false });
|
|
|
+ const hasShadow = w.hasShadow();
|
|
|
+ expect(hasShadow).to.be.a('boolean');
|
|
|
+ });
|
|
|
+
|
|
|
+ // On Windows there's no shadow by default & it can't be changed dynamically.
|
|
|
+ it('can be changed with hasShadow option', () => {
|
|
|
+ const hasShadow = process.platform !== 'darwin';
|
|
|
+ const w = new BrowserWindow({ show: false, hasShadow });
|
|
|
+ expect(w.hasShadow()).to.equal(hasShadow);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('can be changed with setHasShadow method', () => {
|
|
|
+ const w = new BrowserWindow({ show: false });
|
|
|
+ w.setHasShadow(false);
|
|
|
+ expect(w.hasShadow()).to.be.false('hasShadow');
|
|
|
+ w.setHasShadow(true);
|
|
|
+ expect(w.hasShadow()).to.be.true('hasShadow');
|
|
|
+ w.setHasShadow(false);
|
|
|
+ expect(w.hasShadow()).to.be.false('hasShadow');
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
});
|