browser_toolbox_theme.js (1054B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 const PREF_DEVTOOLS_THEME = "devtools.theme"; 5 6 registerCleanupFunction(() => { 7 // Set preferences back to their original values 8 Services.prefs.clearUserPref(PREF_DEVTOOLS_THEME); 9 }); 10 11 add_task(async function testDevtoolsTheme() { 12 info("Checking stylesheet and :root attributes based on devtools theme."); 13 Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "light"); 14 is( 15 document.documentElement.getAttribute("devtoolstheme"), 16 "light", 17 "The element has an attribute based on devtools theme." 18 ); 19 20 Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "dark"); 21 is( 22 document.documentElement.getAttribute("devtoolstheme"), 23 "dark", 24 "The element has an attribute based on devtools theme." 25 ); 26 27 Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "unknown"); 28 is( 29 document.documentElement.getAttribute("devtoolstheme"), 30 "light", 31 "The element has 'light' as a default for the devtoolstheme attribute." 32 ); 33 });