Skip to content

Commit 7153299

Browse files
Add test for new system-theme setting
1 parent 1440b07 commit 7153299

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/librustdoc/html/static/js/settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
{
151151
"name": "Theme",
152152
"js_name": "theme",
153-
"default": "",
153+
"default": "system-preference",
154154
"options": themes.concat("system preference"),
155155
},
156156
{

src/test/rustdoc-gui/settings.goml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ reload:
3535
click: "#settings-menu"
3636
wait-for: "#settings"
3737

38-
// We check that the "Use system theme" is disabled.
39-
assert-property: ("#use-system-theme", {"checked": "false"})
40-
assert: "//*[@class='setting-line']//span[text()='Use system theme']"
38+
// We check that the current theme is not "system theme" is disabled.
39+
assert-property: ("#theme-system-preference", {"checked": "false"})
4140
// Meaning that only the "theme" menu is showing up.
4241
assert: ".setting-line:not(.hidden) #theme"
4342
assert: ".setting-line.hidden #preferred-dark-theme"
@@ -105,13 +104,14 @@ assert-css: (
105104
},
106105
)
107106

108-
// We now switch the display.
109-
click: "#use-system-theme"
107+
// We now select the "system preference" theme.
108+
click: "#theme-system-preference"
109+
// Checking its text.
110+
assert-text: ("#theme-system-preference + span", "system preference")
110111
// Wait for the hidden element to show up.
111112
wait-for: ".setting-line:not(.hidden) #preferred-dark-theme"
112113
assert: ".setting-line:not(.hidden) #preferred-light-theme"
113-
// Check that the theme picking is hidden.
114-
assert: ".setting-line.hidden #theme"
114+
assert-local-storage: {"rustdoc-theme": "system-preference"}
115115

116116
// We check their text as well.
117117
assert-text: ("#preferred-dark-theme .setting-name", "Preferred dark theme")

0 commit comments

Comments
 (0)