diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /devtools/client/framework/test/browser_keybindings_03.js | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/framework/test/browser_keybindings_03.js')
-rw-r--r-- | devtools/client/framework/test/browser_keybindings_03.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/devtools/client/framework/test/browser_keybindings_03.js b/devtools/client/framework/test/browser_keybindings_03.js new file mode 100644 index 0000000000..f01926f2b6 --- /dev/null +++ b/devtools/client/framework/test/browser_keybindings_03.js @@ -0,0 +1,52 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Test that the toolbox 'switch to previous host' feature works. +// Pressing ctrl/cmd+shift+d should switch to the last used host. + +const URL = "data:text/html;charset=utf8,test page for toolbox switching"; + +var { Toolbox } = require("resource://devtools/client/framework/toolbox.js"); + +const { LocalizationHelper } = require("resource://devtools/shared/l10n.js"); +const L10N = new LocalizationHelper( + "devtools/client/locales/toolbox.properties" +); + +add_task(async function () { + info("Create a test tab and open the toolbox"); + const tab = await addTab(URL); + const toolbox = await gDevTools.showToolboxForTab(tab, "webconsole"); + + const shortcut = L10N.getStr("toolbox.toggleHost.key"); + + const { RIGHT, BOTTOM, WINDOW } = Toolbox.HostType; + checkHostType(toolbox, BOTTOM, RIGHT); + + info("Switching from bottom to right"); + let onHostChanged = toolbox.once("host-changed"); + synthesizeKeyShortcut(shortcut, toolbox.win); + await onHostChanged; + checkHostType(toolbox, RIGHT, BOTTOM); + + info("Switching from right to bottom"); + onHostChanged = toolbox.once("host-changed"); + synthesizeKeyShortcut(shortcut, toolbox.win); + await onHostChanged; + checkHostType(toolbox, BOTTOM, RIGHT); + + info("Switching to window"); + await toolbox.switchHost(WINDOW); + checkHostType(toolbox, WINDOW, BOTTOM); + + info("Switching from window to bottom"); + onHostChanged = toolbox.once("host-changed"); + synthesizeKeyShortcut(shortcut, toolbox.win); + await onHostChanged; + checkHostType(toolbox, BOTTOM, WINDOW); + + await toolbox.destroy(); + gBrowser.removeCurrentTab(); +}); |