зеркало из https://github.com/electron/electron.git
Check for devtools in BrowserWindow.getFocusedWindow() (#12526)
This commit is contained in:
Родитель
82f8914f9e
Коммит
970f79e32f
|
@ -134,7 +134,7 @@ BrowserWindow.prototype._init = function () {
|
|||
|
||||
BrowserWindow.getFocusedWindow = () => {
|
||||
for (let window of BrowserWindow.getAllWindows()) {
|
||||
if (window.isFocused()) return window
|
||||
if (window.isFocused() || window.isDevToolsFocused()) return window
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
|
|
@ -419,6 +419,17 @@ describe('BrowserWindow module', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe('BrowserWindow.getFocusedWindow()', (done) => {
|
||||
it('returns the opener window when dev tools window is focused', (done) => {
|
||||
w.show()
|
||||
w.webContents.once('devtools-focused', () => {
|
||||
assert.deepEqual(BrowserWindow.getFocusedWindow(), w)
|
||||
done()
|
||||
})
|
||||
w.webContents.openDevTools({mode: 'undocked'})
|
||||
})
|
||||
})
|
||||
|
||||
describe('BrowserWindow.capturePage(rect, callback)', () => {
|
||||
it('calls the callback with a Buffer', (done) => {
|
||||
w.capturePage({
|
||||
|
|
Загрузка…
Ссылка в новой задаче