summaryrefslogtreecommitdiffstats
path: root/toolkit/components/extensions/test/browser/browser_ext_themes_tab_line.js
blob: e4bd8cb99b0c17fc89dfc47ca9839ee403aafcf3 (plain)
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
"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() {
  let newWin = await BrowserTestUtils.openNewBrowserWindow();

  const TAB_LINE_COLOR = "#ff0000";
  let extension = ExtensionTestUtils.loadExtension({
    manifest: {
      theme: {
        colors: {
          frame: ACCENT_COLOR,
          tab_background_text: "#000",
          tab_line: TAB_LINE_COLOR,
        },
      },
    },
  });

  await extension.startup();

  info("Checking selected tab line color");
  let selectedTab = newWin.document.querySelector(".tabbrowser-tab[selected]");
  let tab = selectedTab.querySelector(".tab-background");
  let element = tab;
  let property = "outline-color";
  let computedValue = newWin.getComputedStyle(element)[property];
  let expectedColor = `rgb(${hexToRGB(TAB_LINE_COLOR).join(", ")})`;

  Assert.ok(
    computedValue.includes(expectedColor),
    `Tab line should be displayed in the box shadow of the tab: ${computedValue}`
  );

  await extension.unload();
  await BrowserTestUtils.closeWindow(newWin);
});