summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-gui/theme-in-history.goml
blob: 10508e86a36e17a4c3d755a85d33ffe842bf639b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Ensures that the theme is working when going back in history.
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
// Set the theme to dark.
local-storage: {
    "rustdoc-theme": "dark",
    "rustdoc-use-system-theme": "false",
}
// We reload the page so the local storage settings are being used.
reload:
assert-css: ("body", { "background-color": "rgb(53, 53, 53)" })
assert-local-storage: { "rustdoc-theme": "dark" }

// Now we go to the settings page.
goto: "file://" + |DOC_PATH| + "/settings.html"
wait-for: "#settings"
// We change the theme to "light".
click: "#theme-light"
wait-for-css: ("body", { "background-color": "rgb(255, 255, 255)" })
assert-local-storage: { "rustdoc-theme": "light" }

// We go back in history.
history-go-back:
// Confirm that we're not on the settings page.
assert-false: "#settings"
// Check that the current theme is still "light".
assert-css: ("body", { "background-color": "rgb(255, 255, 255)" })
assert-local-storage: { "rustdoc-theme": "light" }