2022-01-30 18:39:10 +08:00
|
|
|
// Ensures that the theme is working when going back in history.
|
2024-04-06 03:38:55 +08:00
|
|
|
include: "utils.goml"
|
2023-04-12 01:11:34 +08:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
2024-04-06 03:38:55 +08:00
|
|
|
|
2022-01-30 18:39:10 +08:00
|
|
|
// Set the theme to dark.
|
2024-04-06 03:38:55 +08:00
|
|
|
call-function: ("switch-theme", {"theme": "dark"})
|
|
|
|
|
2023-05-31 19:03:46 +08:00
|
|
|
assert-css: ("body", { "background-color": "#353535" })
|
2022-01-30 18:39:10 +08:00
|
|
|
assert-local-storage: { "rustdoc-theme": "dark" }
|
|
|
|
|
|
|
|
// Now we go to the settings page.
|
2023-04-12 01:11:34 +08:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/settings.html"
|
2022-01-20 06:06:17 +08:00
|
|
|
wait-for: "#settings"
|
2022-01-30 18:39:10 +08:00
|
|
|
// We change the theme to "light".
|
|
|
|
click: "#theme-light"
|
2023-05-31 19:03:46 +08:00
|
|
|
wait-for-css: ("body", { "background-color": "white" })
|
2022-01-30 18:39:10 +08:00
|
|
|
assert-local-storage: { "rustdoc-theme": "light" }
|
|
|
|
|
|
|
|
// We go back in history.
|
|
|
|
history-go-back:
|
|
|
|
// Confirm that we're not on the settings page.
|
2022-01-20 06:06:17 +08:00
|
|
|
assert-false: "#settings"
|
2022-01-30 18:39:10 +08:00
|
|
|
// Check that the current theme is still "light".
|
2023-05-31 19:03:46 +08:00
|
|
|
assert-css: ("body", { "background-color": "white" })
|
2022-01-30 18:39:10 +08:00
|
|
|
assert-local-storage: { "rustdoc-theme": "light" }
|