browser_jsonview_theme.js (847B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 const TEST_JSON_URL = URL_ROOT + "valid_json.json"; 7 8 add_task(async function () { 9 info("Test JSON theme started."); 10 11 const oldPref = Services.prefs.getCharPref("devtools.theme"); 12 Services.prefs.setCharPref("devtools.theme", "light"); 13 14 await addJsonViewTab(TEST_JSON_URL); 15 16 is(await getTheme(), "theme-light", "The initial theme is light"); 17 18 Services.prefs.setCharPref("devtools.theme", "dark"); 19 is(await getTheme(), "theme-dark", "Theme changed to dark"); 20 21 Services.prefs.setCharPref("devtools.theme", "light"); 22 is(await getTheme(), "theme-light", "Theme changed to light"); 23 24 Services.prefs.setCharPref("devtools.theme", oldPref); 25 }); 26 27 function getTheme() { 28 return getElementAttr(":root", "class"); 29 }