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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
add_task(async function noItemsInTheCollectionBeforeShiftClicking() {
let tab1 = await addTab();
let tab2 = await addTab();
let tab3 = await addTab();
let tab4 = await addTab();
let tab5 = await addTab();
await BrowserTestUtils.switchTab(gBrowser, tab1);
is(gBrowser.selectedTab, tab1, "Tab1 has focus now");
is(gBrowser.multiSelectedTabsCount, 0, "No tab is multi-selected");
gBrowser.hideTab(tab3);
ok(tab3.hidden, "Tab3 is hidden");
info("Click on tab4 while holding shift key");
await triggerClickOn(tab4, { shiftKey: true });
ok(
tab1.multiselected && gBrowser._multiSelectedTabsSet.has(tab1),
"Tab1 is multi-selected"
);
ok(
tab2.multiselected && gBrowser._multiSelectedTabsSet.has(tab2),
"Tab2 is multi-selected"
);
ok(
!tab3.multiselected && !gBrowser._multiSelectedTabsSet.has(tab3),
"Hidden tab3 is not multi-selected"
);
ok(
tab4.multiselected && gBrowser._multiSelectedTabsSet.has(tab4),
"Tab4 is multi-selected"
);
ok(
!tab5.multiselected && !gBrowser._multiSelectedTabsSet.has(tab5),
"Tab5 is not multi-selected"
);
is(gBrowser.multiSelectedTabsCount, 3, "three multi-selected tabs");
is(gBrowser.selectedTab, tab1, "Tab1 still has focus");
BrowserTestUtils.removeTab(tab1);
BrowserTestUtils.removeTab(tab2);
BrowserTestUtils.removeTab(tab3);
BrowserTestUtils.removeTab(tab4);
BrowserTestUtils.removeTab(tab5);
});
add_task(async function itemsInTheCollectionBeforeShiftClicking() {
let tab1 = await addTab();
let tab2 = await addTab();
let tab3 = await addTab();
let tab4 = await addTab();
let tab5 = await addTab();
await BrowserTestUtils.switchTab(gBrowser, () => triggerClickOn(tab1, {}));
is(gBrowser.selectedTab, tab1, "Tab1 has focus now");
is(gBrowser.multiSelectedTabsCount, 0, "No tab is multi-selected");
await triggerClickOn(tab3, { ctrlKey: true });
is(gBrowser.selectedTab, tab1, "Tab1 still has focus");
is(gBrowser.multiSelectedTabsCount, 2, "Two tabs are multi-selected");
ok(
tab1.multiselected && gBrowser._multiSelectedTabsSet.has(tab1),
"Tab1 is multi-selected"
);
ok(
tab3.multiselected && gBrowser._multiSelectedTabsSet.has(tab3),
"Tab3 is multi-selected"
);
info("Click on tab5 while holding Shift key");
await BrowserTestUtils.switchTab(
gBrowser,
triggerClickOn(tab5, { shiftKey: true })
);
is(gBrowser.selectedTab, tab3, "Tab3 has focus");
ok(
!tab1.multiselected && !gBrowser._multiSelectedTabsSet.has(tab1),
"Tab1 is not multi-selected"
);
ok(
!tab2.multiselected && !gBrowser._multiSelectedTabsSet.has(tab2),
"Tab2 is not multi-selected "
);
ok(
tab3.multiselected && gBrowser._multiSelectedTabsSet.has(tab3),
"Tab3 is multi-selected"
);
ok(
tab4.multiselected && gBrowser._multiSelectedTabsSet.has(tab4),
"Tab4 is multi-selected"
);
ok(
tab5.multiselected && gBrowser._multiSelectedTabsSet.has(tab5),
"Tab5 is multi-selected"
);
is(gBrowser.multiSelectedTabsCount, 3, "Three tabs are multi-selected");
info("Click on tab4 while holding Shift key");
await triggerClickOn(tab4, { shiftKey: true });
is(gBrowser.selectedTab, tab3, "Tab3 has focus");
ok(
!tab1.multiselected && !gBrowser._multiSelectedTabsSet.has(tab1),
"Tab1 is not multi-selected"
);
ok(
!tab2.multiselected && !gBrowser._multiSelectedTabsSet.has(tab2),
"Tab2 is not multi-selected "
);
ok(
tab3.multiselected && gBrowser._multiSelectedTabsSet.has(tab3),
"Tab3 is multi-selected"
);
ok(
tab4.multiselected && gBrowser._multiSelectedTabsSet.has(tab4),
"Tab4 is multi-selected"
);
ok(
!tab5.multiselected && !gBrowser._multiSelectedTabsSet.has(tab5),
"Tab5 is not multi-selected"
);
is(gBrowser.multiSelectedTabsCount, 2, "Two tabs are multi-selected");
info("Click on tab1 while holding Shift key");
await triggerClickOn(tab1, { shiftKey: true });
is(gBrowser.selectedTab, tab3, "Tab3 has focus");
ok(
tab1.multiselected && gBrowser._multiSelectedTabsSet.has(tab1),
"Tab1 is multi-selected"
);
ok(
tab2.multiselected && gBrowser._multiSelectedTabsSet.has(tab2),
"Tab2 is multi-selected "
);
ok(
tab3.multiselected && gBrowser._multiSelectedTabsSet.has(tab3),
"Tab3 is multi-selected"
);
ok(
!tab4.multiselected && !gBrowser._multiSelectedTabsSet.has(tab4),
"Tab4 is not multi-selected"
);
ok(
!tab5.multiselected && !gBrowser._multiSelectedTabsSet.has(tab5),
"Tab5 is not multi-selected"
);
is(gBrowser.multiSelectedTabsCount, 3, "Three tabs are multi-selected");
BrowserTestUtils.removeTab(tab1);
BrowserTestUtils.removeTab(tab2);
BrowserTestUtils.removeTab(tab3);
BrowserTestUtils.removeTab(tab4);
BrowserTestUtils.removeTab(tab5);
});
|