diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /browser/base/content/test/tabs/browser_multiselect_tabs_active_tab_selected_by_default.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/base/content/test/tabs/browser_multiselect_tabs_active_tab_selected_by_default.js')
-rw-r--r-- | browser/base/content/test/tabs/browser_multiselect_tabs_active_tab_selected_by_default.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/browser/base/content/test/tabs/browser_multiselect_tabs_active_tab_selected_by_default.js b/browser/base/content/test/tabs/browser_multiselect_tabs_active_tab_selected_by_default.js new file mode 100644 index 0000000000..8edf56d3d4 --- /dev/null +++ b/browser/base/content/test/tabs/browser_multiselect_tabs_active_tab_selected_by_default.js @@ -0,0 +1,52 @@ +add_task(async function multiselectActiveTabByDefault() { + const tab1 = await addTab(); + const tab2 = await addTab(); + const tab3 = await addTab(); + + await BrowserTestUtils.switchTab(gBrowser, tab1); + + info("Try multiselecting Tab1 (active) with click+CtrlKey"); + await triggerClickOn(tab1, { ctrlKey: true }); + + is(gBrowser.selectedTab, tab1, "Tab1 is active"); + ok( + !tab1.multiselected, + "Tab1 is not multi-selected because we are not in multi-select context yet" + ); + ok(!tab2.multiselected, "Tab2 is not multi-selected"); + ok(!tab3.multiselected, "Tab3 is not multi-selected"); + is(gBrowser.multiSelectedTabsCount, 0, "Zero tabs multi-selected"); + + info("We multi-select tab1 and tab2 with ctrl key down"); + await triggerClickOn(tab2, { ctrlKey: true }); + await triggerClickOn(tab3, { ctrlKey: true }); + + is(gBrowser.selectedTab, tab1, "Tab1 is active"); + ok(tab1.multiselected, "Tab1 is multi-selected"); + ok(tab2.multiselected, "Tab2 is multi-selected"); + ok(tab3.multiselected, "Tab3 is multi-selected"); + is(gBrowser.multiSelectedTabsCount, 3, "Three tabs multi-selected"); + is( + gBrowser.lastMultiSelectedTab, + tab3, + "Tab3 is the last multi-selected tab" + ); + + info("Unselect tab1 from multi-selection using ctrlKey"); + + await BrowserTestUtils.switchTab( + gBrowser, + triggerClickOn(tab1, { ctrlKey: true }) + ); + + isnot(gBrowser.selectedTab, tab1, "Tab1 is not active anymore"); + is(gBrowser.selectedTab, tab3, "Tab3 is active"); + ok(!tab1.multiselected, "Tab1 is not multi-selected"); + ok(tab2.multiselected, "Tab2 is multi-selected"); + ok(tab3.multiselected, "Tab3 is multi-selected"); + is(gBrowser.multiSelectedTabsCount, 2, "Two tabs multi-selected"); + + BrowserTestUtils.removeTab(tab1); + BrowserTestUtils.removeTab(tab2); + BrowserTestUtils.removeTab(tab3); +}); |