fix: correctly enable and disable windows on Windows and Linux (backport: 3-0-x) (#15255)

* fix: correctly enable and disable windows

* Move has_child_modal_ to NativeWindowViews

* Track modal children as an int instead of a bool

* Use correct types

* Move Increment/DecrementChildModals to NativeWindowViews

* Use parent() in NativeWindowViews

* Add test for not enabling disabled parent when modal child closes
This commit is contained in:
trop[bot] 2018-10-19 17:30:55 -07:00 committed by Shelley Vohr
commit 9349b0a273
3 changed files with 54 additions and 17 deletions

View file

@ -2747,7 +2747,7 @@ describe('BrowserWindow module', () => {
c.show()
assert.equal(w.isEnabled(), false)
})
it('enables parent window when closed', (done) => {
it('re-enables an enabled parent window when closed', (done) => {
c.once('closed', () => {
assert.equal(w.isEnabled(), true)
done()
@ -2755,6 +2755,15 @@ describe('BrowserWindow module', () => {
c.show()
c.close()
})
it('does not re-enable a disabled parent window when closed', (done) => {
c.once('closed', () => {
assert.strictEqual(w.isEnabled(), false)
done()
})
w.setEnabled(false)
c.show()
c.close()
})
it('disables parent window recursively', () => {
let c2 = new BrowserWindow({show: false, parent: w, modal: true})
c.show()