Bug 1488000 - Allow theming sidebar border color. r=jaws

Differential Revision: https://phabricator.services.mozilla.com/D4839

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tim Nguyen 2018-09-04 21:33:46 +00:00
parent 11dd9afb58
commit eda7b67115
4 changed files with 47 additions and 0 deletions

View File

@ -97,6 +97,10 @@ const ThemeVariableMap = [
lwtProperty: "sidebar_text",
optionalElementID: "sidebar-box",
}],
["--sidebar-border-color", {
lwtProperty: "sidebar_border",
optionalElementID: "browser",
}],
];
const ThemeContentPropertyList = [

View File

@ -187,6 +187,7 @@ class Theme {
case "ntp_background":
case "ntp_text":
case "sidebar":
case "sidebar_border":
case "sidebar_text":
case "sidebar_highlight":
case "sidebar_highlight_text":

View File

@ -241,6 +241,10 @@
"$ref": "ThemeColor",
"optional": true
},
"sidebar_border": {
"$ref": "ThemeColor",
"optional": true
},
"sidebar_text": {
"$ref": "ThemeColor",
"optional": true

View File

@ -147,3 +147,41 @@ add_task(async function test_support_sidebar_colors() {
}, false);
}
});
add_task(async function test_support_sidebar_border_color() {
const LIGHT_SALMON = "#ffa07a";
const extension = ExtensionTestUtils.loadExtension({
manifest: {
theme: {
colors: {
sidebar_border: LIGHT_SALMON,
},
},
},
});
await extension.startup();
const sidebarHeader = document.getElementById("sidebar-header");
const sidebarHeaderCS = window.getComputedStyle(sidebarHeader);
is(sidebarHeaderCS.borderBottomColor, hexToCSS(LIGHT_SALMON),
"Sidebar header border should be colored properly");
if (AppConstants.platform !== "linux") {
const sidebarSplitter = document.getElementById("sidebar-splitter");
const sidebarSplitterCS = window.getComputedStyle(sidebarSplitter);
is(sidebarSplitterCS.borderInlineEndColor, hexToCSS(LIGHT_SALMON),
"Sidebar splitter should be colored properly");
SidebarUI.reversePosition();
is(sidebarSplitterCS.borderInlineStartColor, hexToCSS(LIGHT_SALMON),
"Sidebar splitter should be colored properly after switching sides");
SidebarUI.reversePosition();
}
await extension.unload();
});