1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
const PREF_WARN_ON_CLOSE = "browser.tabs.warnOnCloseOtherTabs";
add_task(async function setPref() {
await SpecialPowers.pushPrefEnv({
set: [[PREF_WARN_ON_CLOSE, false]],
});
});
add_task(async function checkBeforeMultiselectedAttributes() {
let tab1 = await addTab();
let tab2 = await addTab();
let tab3 = await addTab();
let visibleTabs = gBrowser._visibleTabs;
await triggerClickOn(tab3, { ctrlKey: true });
is(visibleTabs.indexOf(tab1), 1, "The index of Tab1 is one");
is(visibleTabs.indexOf(tab2), 2, "The index of Tab2 is two");
is(visibleTabs.indexOf(tab3), 3, "The index of Tab3 is three");
ok(!tab1.multiselected, "Tab1 is not multi-selected");
ok(!tab2.multiselected, "Tab2 is not multi-selected");
ok(tab3.multiselected, "Tab3 is multi-selected");
ok(!tab1.beforeMultiselected, "Tab1 is not before-multiselected");
ok(tab2.beforeMultiselected, "Tab2 is before-multiselected");
info("Close Tab2");
let tab2Closing = BrowserTestUtils.waitForTabClosing(tab2);
BrowserTestUtils.removeTab(tab2);
await tab2Closing;
// Cache invalidated, so we need to update the collection
visibleTabs = gBrowser._visibleTabs;
is(visibleTabs.indexOf(tab1), 1, "The index of Tab1 is one");
is(visibleTabs.indexOf(tab3), 2, "The index of Tab3 is two");
ok(tab1.beforeMultiselected, "Tab1 is before-multiselected");
// Checking if positional attributes are updated when "active" tab is clicked.
info("Click on the active tab to clear multiselect");
await triggerClickOn(gBrowser.selectedTab, {});
is(gBrowser.multiSelectedTabsCount, 0, "Zero multiselected tabs");
ok(!tab1.beforeMultiselected, "Tab1 is not before-multiselected anymore");
BrowserTestUtils.removeTab(tab1);
BrowserTestUtils.removeTab(tab3);
});
|