spec: fix race condition in alwaysOnTop test

This commit is contained in:
Samuel Attard
2023-05-09 02:55:37 -07:00
parent 5cb790907c
commit 2ec5213fa0

View File

@@ -2227,13 +2227,17 @@ describe('BrowserWindow module', () => {
expect(w.isAlwaysOnTop()).to.be.true('is not alwaysOnTop');
});
ifit(process.platform === 'darwin')('resets the windows level on minimize', () => {
ifit(process.platform === 'darwin')('resets the windows level on minimize', async () => {
expect(w.isAlwaysOnTop()).to.be.false('is alwaysOnTop');
w.setAlwaysOnTop(true, 'screen-saver');
expect(w.isAlwaysOnTop()).to.be.true('is not alwaysOnTop');
const minimized = once(w, 'minimize');
w.minimize();
await minimized;
expect(w.isAlwaysOnTop()).to.be.false('is alwaysOnTop');
const restored = once(w, 'restore');
w.restore();
await restored;
expect(w.isAlwaysOnTop()).to.be.true('is not alwaysOnTop');
});