From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../client/framework/test/browser_toolbox_theme.js | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 devtools/client/framework/test/browser_toolbox_theme.js (limited to 'devtools/client/framework/test/browser_toolbox_theme.js') 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." + ); +}); -- cgit v1.2.3