зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1169993 - Fix setTheme in theme.js to really trigger a theme change in Developer Tools. r=bgrins
This commit is contained in:
Родитель
40947280a2
Коммит
b5d493f508
|
@ -27,6 +27,14 @@ function testGetTheme () {
|
|||
|
||||
function testSetTheme () {
|
||||
let originalTheme = getTheme();
|
||||
gDevTools.once("pref-changed", (_, { pref, oldValue, newValue }) => {
|
||||
is(pref, "devtools.theme",
|
||||
"The 'pref-changed' event triggered by setTheme has correct pref.");
|
||||
is(oldValue, originalTheme,
|
||||
"The 'pref-changed' event triggered by setTheme has correct oldValue.");
|
||||
is(newValue, "dark",
|
||||
"The 'pref-changed' event triggered by setTheme has correct newValue.");
|
||||
});
|
||||
setTheme("dark");
|
||||
is(Services.prefs.getCharPref("devtools.theme"), "dark", "setTheme() correctly sets dark theme.");
|
||||
setTheme("light");
|
||||
|
|
|
@ -85,10 +85,12 @@ const getColor = exports.getColor = (type, theme) => {
|
|||
* the themeing.
|
||||
*/
|
||||
const setTheme = exports.setTheme = (newTheme) => {
|
||||
let oldTheme = getTheme();
|
||||
|
||||
Services.prefs.setCharPref("devtools.theme", newTheme);
|
||||
gDevTools.emit("pref-changed", {
|
||||
pref: "devtools.theme",
|
||||
newValue: newTheme,
|
||||
oldValue: getTheme()
|
||||
oldValue: oldTheme
|
||||
});
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче