From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../browser_ext_commands_execute_sidebar_action.js | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 browser/components/extensions/test/browser/browser_ext_commands_execute_sidebar_action.js (limited to 'browser/components/extensions/test/browser/browser_ext_commands_execute_sidebar_action.js') diff --git a/browser/components/extensions/test/browser/browser_ext_commands_execute_sidebar_action.js b/browser/components/extensions/test/browser/browser_ext_commands_execute_sidebar_action.js new file mode 100644 index 0000000000..0f96138d09 --- /dev/null +++ b/browser/components/extensions/test/browser/browser_ext_commands_execute_sidebar_action.js @@ -0,0 +1,56 @@ +/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set sts=2 sw=2 et tw=80: */ +"use strict"; + +add_task(async function test_execute_sidebar_action() { + let extension = ExtensionTestUtils.loadExtension({ + manifest: { + commands: { + _execute_sidebar_action: { + suggested_key: { + default: "Alt+Shift+J", + }, + }, + }, + sidebar_action: { + default_panel: "sidebar.html", + }, + }, + // We want to confirm that sidebar is not shown on every extension start, + // so we use an explicit APP_STARTUP. + startupReason: "APP_STARTUP", + files: { + "sidebar.html": ` + + + + + + + + `, + + "sidebar.js": function () { + browser.runtime.sendMessage("from-sidebar-action"); + }, + }, + background() { + browser.runtime.onMessage.addListener(msg => { + if (msg == "from-sidebar-action") { + browser.test.notifyPass("execute-sidebar-action-opened"); + } + }); + }, + }); + + await extension.startup(); + await SimpleTest.promiseFocus(window); + ok( + document.getElementById("sidebar-box").hidden, + `Sidebar box is not visible after "not-first" startup.` + ); + // Send the key to open the sidebar. + EventUtils.synthesizeKey("j", { altKey: true, shiftKey: true }); + await extension.awaitFinish("execute-sidebar-action-opened"); + await extension.unload(); +}); -- cgit v1.2.3