fix: navigator.keyboard.lock() fullscreen exit handling (#40365)

fix: navigator.keyboard.lock() fullscreen exit handling
This commit is contained in:
Shelley Vohr 2023-10-31 11:59:39 -04:00 committed by GitHub
parent 4b1c31e4db
commit fcdd5cba71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 86 additions and 16 deletions

View file

@ -547,17 +547,16 @@ describe('<webview> tag', function () {
await close;
});
// Sending ESC via sendInputEvent only works on Windows.
ifit(process.platform === 'win32')('pressing ESC should unfullscreen window', async () => {
it('pressing ESC should unfullscreen window', async () => {
const [w, webview] = await loadWebViewWindow();
const enterFullScreen = once(w, 'enter-full-screen');
await webview.executeJavaScript('document.getElementById("div").requestFullscreen()', true);
await enterFullScreen;
const leaveFullScreen = once(w, 'leave-full-screen');
w.webContents.sendInputEvent({ type: 'keyDown', keyCode: 'Escape' });
webview.sendInputEvent({ type: 'keyDown', keyCode: 'Escape' });
await leaveFullScreen;
await setTimeout();
await setTimeout(1000);
expect(w.isFullScreen()).to.be.false();
const close = once(w, 'closed');