Skip to content

Commit 5e48378

Browse files
authored
Rollup merge of #93475 - GuillaumeGomez:theme-in-history, r=jsha
Add test to ensure that theme is applied correctly when going back in history Fixes #93258. r? `@jsha`
2 parents cee571e + 2604968 commit 5e48378

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Ensures that the theme is working when going back in history.
2+
goto: file://|DOC_PATH|/test_docs/index.html
3+
// Set the theme to dark.
4+
local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
5+
// We reload the page so the local storage settings are being used.
6+
reload:
7+
assert-css: ("body", { "background-color": "rgb(53, 53, 53)" })
8+
assert-local-storage: { "rustdoc-theme": "dark" }
9+
10+
// Now we go to the settings page.
11+
click: "#settings-menu"
12+
wait-for: ".settings"
13+
// We change the theme to "light".
14+
click: "#theme-light"
15+
wait-for: 250
16+
assert-css: ("body", { "background-color": "rgb(255, 255, 255)" })
17+
assert-local-storage: { "rustdoc-theme": "light" }
18+
19+
// We go back in history.
20+
history-go-back:
21+
// Confirm that we're not on the settings page.
22+
assert-false: ".settings"
23+
// Check that the current theme is still "light".
24+
assert-css: ("body", { "background-color": "rgb(255, 255, 255)" })
25+
assert-local-storage: { "rustdoc-theme": "light" }

0 commit comments

Comments
 (0)