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_copy_through_drag_and_drop.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 '')
-rw-r--r-- | browser/base/content/test/tabs/browser_multiselect_tabs_copy_through_drag_and_drop.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/browser/base/content/test/tabs/browser_multiselect_tabs_copy_through_drag_and_drop.js b/browser/base/content/test/tabs/browser_multiselect_tabs_copy_through_drag_and_drop.js new file mode 100644 index 0000000000..029708560a --- /dev/null +++ b/browser/base/content/test/tabs/browser_multiselect_tabs_copy_through_drag_and_drop.js @@ -0,0 +1,51 @@ +add_task(async function test() { + let tab0 = gBrowser.selectedTab; + // eslint-disable-next-line @microsoft/sdl/no-insecure-url + let tab1 = await addTab("http://example.com/1"); + // eslint-disable-next-line @microsoft/sdl/no-insecure-url + let tab2 = await addTab("http://example.com/2"); + // eslint-disable-next-line @microsoft/sdl/no-insecure-url + let tab3 = await addTab("http://example.com/3"); + let tabs = [tab0, tab1, tab2, tab3]; + + await BrowserTestUtils.switchTab(gBrowser, tab1); + await triggerClickOn(tab2, { ctrlKey: true }); + + is(gBrowser.selectedTab, tab1, "Tab1 is active"); + is(gBrowser.selectedTabs.length, 2, "Two selected tabs"); + is(gBrowser.visibleTabs.length, 4, "Four tabs in window before copy"); + + for (let i of [1, 2]) { + ok(tabs[i].multiselected, "Tab" + i + " is multiselected"); + } + for (let i of [0, 3]) { + ok(!tabs[i].multiselected, "Tab" + i + " is not multiselected"); + } + + await dragAndDrop(tab1, tab3, true); + + is(gBrowser.selectedTab, tab1, "tab1 is still active"); + is(gBrowser.selectedTabs.length, 2, "Two selected tabs"); + is(gBrowser.visibleTabs.length, 6, "Six tabs in window after copy"); + + let tab4 = gBrowser.visibleTabs[4]; + let tab5 = gBrowser.visibleTabs[5]; + tabs.push(tab4); + tabs.push(tab5); + + for (let i of [1, 2]) { + ok(tabs[i].multiselected, "Tab" + i + " is multiselected"); + } + for (let i of [0, 3, 4, 5]) { + ok(!tabs[i].multiselected, "Tab" + i + " is not multiselected"); + } + + await BrowserTestUtils.waitForCondition(() => getUrl(tab4) == getUrl(tab1)); + await BrowserTestUtils.waitForCondition(() => getUrl(tab5) == getUrl(tab2)); + + ok(true, "Tab1 and tab2 are duplicated succesfully"); + + for (let tab of tabs.filter(t => t != tab0)) { + BrowserTestUtils.removeTab(tab); + } +}); |