Skip to content

Commit 2f074de

Browse files
Extend settings test to ensure settings text is as expected
1 parent e7d7d75 commit 2f074de

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/test/rustdoc-gui/settings.goml

+29
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,32 @@ click: "#settings-menu"
3636
wait-for: "#alternative-display #settings"
3737
assert: "#not-displayed #search"
3838
assert: "#main-content.hidden"
39+
40+
// Now let's check the content of the settings menu.
41+
local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
42+
reload:
43+
click: "#settings-menu"
44+
wait-for: "#settings"
45+
46+
// We check that the "Use system theme" is disabled.
47+
assert-property: ("#use-system-theme", {"checked": "false"})
48+
assert: "//*[@class='setting-line']/*[text()='Use system theme']"
49+
// Meaning that only the "theme" menu is showing up.
50+
assert: ".setting-line:not(.hidden) #theme"
51+
assert: ".setting-line.hidden #preferred-dark-theme"
52+
assert: ".setting-line.hidden #preferred-light-theme"
53+
54+
// We check that the correct theme is selected.
55+
assert-property: ("#theme .choices #theme-dark", {"checked": "true"})
56+
57+
// We now switch the display.
58+
click: "#use-system-theme"
59+
// Wait for the hidden element to show up.
60+
wait-for: ".setting-line:not(.hidden) #preferred-dark-theme"
61+
assert: ".setting-line:not(.hidden) #preferred-light-theme"
62+
// Check that the theme picking is hidden.
63+
assert: ".setting-line.hidden #theme"
64+
65+
// We check their text as well.
66+
assert-text: ("#preferred-dark-theme .setting-name", "Preferred dark theme")
67+
assert-text: ("#preferred-light-theme .setting-name", "Preferred light theme")

0 commit comments

Comments
 (0)