summaryrefslogtreecommitdiffstats
path: root/devtools/client/framework/test/browser_toolbox_theme.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /devtools/client/framework/test/browser_toolbox_theme.js
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/framework/test/browser_toolbox_theme.js')
-rw-r--r--devtools/client/framework/test/browser_toolbox_theme.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/devtools/client/framework/test/browser_toolbox_theme.js b/devtools/client/framework/test/browser_toolbox_theme.js
new file mode 100644
index 0000000000..63d83e8312
--- /dev/null
+++ b/devtools/client/framework/test/browser_toolbox_theme.js
@@ -0,0 +1,33 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+const PREF_DEVTOOLS_THEME = "devtools.theme";
+
+registerCleanupFunction(() => {
+ // Set preferences back to their original values
+ Services.prefs.clearUserPref(PREF_DEVTOOLS_THEME);
+});
+
+add_task(async function testDevtoolsTheme() {
+ info("Checking stylesheet and :root attributes based on devtools theme.");
+ Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "light");
+ is(
+ document.getElementById("appcontent").getAttribute("devtoolstheme"),
+ "light",
+ "The element has an attribute based on devtools theme."
+ );
+
+ Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "dark");
+ is(
+ document.getElementById("appcontent").getAttribute("devtoolstheme"),
+ "dark",
+ "The element has an attribute based on devtools theme."
+ );
+
+ Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "unknown");
+ is(
+ document.getElementById("appcontent").getAttribute("devtoolstheme"),
+ "light",
+ "The element has 'light' as a default for the devtoolstheme attribute."
+ );
+});