mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: DCHECK minimizing parent window with non-modal child (#38508)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
@@ -4249,11 +4249,13 @@ describe('BrowserWindow module', () => {
|
||||
const c = new BrowserWindow({ show: false, parent: w });
|
||||
expect(c.getParentWindow()).to.equal(w);
|
||||
});
|
||||
|
||||
it('adds window to child windows of parent', () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
const c = new BrowserWindow({ show: false, parent: w });
|
||||
expect(w.getChildWindows()).to.deep.equal([c]);
|
||||
});
|
||||
|
||||
it('removes from child windows of parent when window is closed', async () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
const c = new BrowserWindow({ show: false, parent: w });
|
||||
@@ -4265,6 +4267,59 @@ describe('BrowserWindow module', () => {
|
||||
expect(w.getChildWindows().length).to.equal(0);
|
||||
});
|
||||
|
||||
ifit(process.platform === 'darwin')('child window matches visibility when visibility changes', async () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
const c = new BrowserWindow({ show: false, parent: w });
|
||||
|
||||
const wShow = emittedOnce(w, 'show');
|
||||
const cShow = emittedOnce(c, 'show');
|
||||
|
||||
w.show();
|
||||
c.show();
|
||||
|
||||
await Promise.all([wShow, cShow]);
|
||||
|
||||
const minimized = emittedOnce(w, 'minimize');
|
||||
w.minimize();
|
||||
await minimized;
|
||||
|
||||
expect(w.isVisible()).to.be.false('parent is visible');
|
||||
expect(c.isVisible()).to.be.false('child is visible');
|
||||
|
||||
const restored = emittedOnce(w, 'restore');
|
||||
w.restore();
|
||||
await restored;
|
||||
|
||||
expect(w.isVisible()).to.be.true('parent is visible');
|
||||
expect(c.isVisible()).to.be.true('child is visible');
|
||||
});
|
||||
|
||||
ifit(process.platform === 'darwin')('matches child window visibility when visibility changes', async () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
const c = new BrowserWindow({ show: false, parent: w });
|
||||
|
||||
const wShow = emittedOnce(w, 'show');
|
||||
const cShow = emittedOnce(c, 'show');
|
||||
|
||||
w.show();
|
||||
c.show();
|
||||
|
||||
await Promise.all([wShow, cShow]);
|
||||
|
||||
const minimized = emittedOnce(c, 'minimize');
|
||||
c.minimize();
|
||||
await minimized;
|
||||
|
||||
expect(c.isVisible()).to.be.false('child is visible');
|
||||
|
||||
const restored = emittedOnce(c, 'restore');
|
||||
c.restore();
|
||||
await restored;
|
||||
|
||||
expect(w.isVisible()).to.be.true('parent is visible');
|
||||
expect(c.isVisible()).to.be.true('child is visible');
|
||||
});
|
||||
|
||||
it('closes a grandchild window when a middle child window is destroyed', (done) => {
|
||||
const w = new BrowserWindow();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user