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
|
"use strict";
// This test checks whether applied WebExtension themes that attempt to change
// the color of the tab line are applied properly.
add_task(async function test_support_tab_line() {
for (let protonTabsEnabled of [true, false]) {
SpecialPowers.pushPrefEnv({
set: [["browser.proton.tabs.enabled", protonTabsEnabled]],
});
let newWin = await BrowserTestUtils.openNewWindowWithFlushedXULCacheForMozSupports();
const TAB_LINE_COLOR = "#9400ff";
let extension = ExtensionTestUtils.loadExtension({
manifest: {
theme: {
colors: {
frame: ACCENT_COLOR,
tab_background_text: TEXT_COLOR,
tab_line: TAB_LINE_COLOR,
},
},
},
});
await extension.startup();
info("Checking selected tab line color");
let selectedTab = newWin.document.querySelector(
".tabbrowser-tab[selected]"
);
let line = selectedTab.querySelector(".tab-line");
if (protonTabsEnabled) {
Assert.equal(
newWin.getComputedStyle(line).display,
"none",
"Tab line should not be displayed when Proton is enabled"
);
} else {
Assert.equal(
newWin.getComputedStyle(line).backgroundColor,
`rgb(${hexToRGB(TAB_LINE_COLOR).join(", ")})`,
"Tab line should have theme color"
);
}
await extension.unload();
await BrowserTestUtils.closeWindow(newWin);
}
});
|