2023-04-07 03:25:07 +00:00
|
|
|
// Ensure that the theme picker always starts with the actual defaults.
|
2023-04-11 17:11:34 +00:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
2023-04-07 03:25:07 +00:00
|
|
|
click: "#settings-menu"
|
|
|
|
wait-for: "#theme-system-preference"
|
|
|
|
assert: "#theme-system-preference:checked"
|
|
|
|
assert: "#preferred-light-theme-light:checked"
|
|
|
|
assert: "#preferred-dark-theme-dark:checked"
|
|
|
|
assert-false: "#preferred-dark-theme-ayu:checked"
|
|
|
|
|
|
|
|
// Test legacy migration from old theme setup without system-preference matching.
|
|
|
|
// See https://github.com/rust-lang/rust/pull/77809#issuecomment-707875732
|
2023-04-11 17:11:34 +00:00
|
|
|
set-local-storage: {
|
2023-04-07 03:25:07 +00:00
|
|
|
"rustdoc-preferred-light-theme": null,
|
|
|
|
"rustdoc-preferred-dark-theme": null,
|
|
|
|
"rustdoc-use-system-theme": null,
|
|
|
|
"rustdoc-theme": "ayu"
|
|
|
|
}
|
2023-04-11 17:11:34 +00:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
2023-04-07 03:25:07 +00:00
|
|
|
click: "#settings-menu"
|
|
|
|
wait-for: "#theme-system-preference"
|
|
|
|
assert: "#theme-system-preference:checked"
|
|
|
|
assert: "#preferred-light-theme-light:checked"
|
|
|
|
assert-false: "#preferred-dark-theme-dark:checked"
|
|
|
|
assert: "#preferred-dark-theme-ayu:checked"
|