diff options
Diffstat (limited to 'devtools/client/webconsole/test/browser/browser_jsterm_focus_reload.js')
-rw-r--r-- | devtools/client/webconsole/test/browser/browser_jsterm_focus_reload.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/devtools/client/webconsole/test/browser/browser_jsterm_focus_reload.js b/devtools/client/webconsole/test/browser/browser_jsterm_focus_reload.js new file mode 100644 index 0000000000..5bafa3943d --- /dev/null +++ b/devtools/client/webconsole/test/browser/browser_jsterm_focus_reload.js @@ -0,0 +1,29 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Check that the console does not steal the focus when reloading a page, if the focus +// is on the content page. + +"use strict"; + +const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8>Focus test`; + +add_task(async function () { + info("Testing that messages disappear on a refresh if logs aren't persisted"); + const hud = await openNewTabAndConsole(TEST_URI); + is(isInputFocused(hud), true, "JsTerm is focused when opening the console"); + + info("Put the focus on the content page"); + SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => content.focus()); + await waitFor(() => isInputFocused(hud) === false); + + info( + "Reload the page to check that JsTerm does not steal the content page focus" + ); + await reloadBrowser(); + is( + isInputFocused(hud), + false, + "JsTerm is still unfocused after reloading the page" + ); +}); |