fix: {exit|enter}-html-fullscreen emitted after esc in webview (#30537)
This commit is contained in:
parent
7cdd132d18
commit
a9a90fa1b6
3 changed files with 43 additions and 9 deletions
|
@ -456,6 +456,34 @@ describe('<webview> tag', function () {
|
|||
await delay(0);
|
||||
expect(w.isFullScreen()).to.be.false();
|
||||
});
|
||||
|
||||
it('pressing ESC should emit the leave-html-full-screen event', async () => {
|
||||
const w = new BrowserWindow({
|
||||
show: false,
|
||||
webPreferences: {
|
||||
webviewTag: true,
|
||||
nodeIntegration: true,
|
||||
contextIsolation: false
|
||||
}
|
||||
});
|
||||
|
||||
const didAttachWebview = emittedOnce(w.webContents, 'did-attach-webview');
|
||||
w.loadFile(path.join(fixtures, 'pages', 'webview-did-attach-event.html'));
|
||||
|
||||
const [, webContents] = await didAttachWebview;
|
||||
|
||||
const enterFSWindow = emittedOnce(w, 'enter-html-full-screen');
|
||||
const enterFSWebview = emittedOnce(webContents, 'enter-html-full-screen');
|
||||
await webContents.executeJavaScript('document.getElementById("div").requestFullscreen()', true);
|
||||
await enterFSWindow;
|
||||
await enterFSWebview;
|
||||
|
||||
const leaveFSWindow = emittedOnce(w, 'leave-html-full-screen');
|
||||
const leaveFSWebview = emittedOnce(webContents, 'leave-html-full-screen');
|
||||
webContents.sendInputEvent({ type: 'keyDown', keyCode: 'Escape' });
|
||||
await leaveFSWindow;
|
||||
await leaveFSWebview;
|
||||
});
|
||||
});
|
||||
|
||||
describe('nativeWindowOpen option', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue