rust/tests/rustdoc-gui/theme-change.goml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

68 lines
2.6 KiB
Plaintext
Raw Normal View History

2022-01-21 13:41:47 -06:00
// Ensures that the theme change is working as expected.
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
set-local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "dark"}
2022-05-11 16:11:31 -05:00
reload:
2022-11-13 14:37:42 -06:00
store-value: (background_light, "rgb(255, 255, 255)")
store-value: (background_dark, "rgb(53, 53, 53)")
store-value: (background_ayu, "rgb(15, 20, 25)")
2022-05-11 16:11:31 -05:00
click: "#settings-menu"
wait-for: "#theme-ayu"
click: "#theme-ayu"
// should be the ayu theme so let's check the color.
2022-11-13 14:37:42 -06:00
wait-for-css: ("body", { "background-color": |background_ayu| })
2022-05-11 16:11:31 -05:00
assert-local-storage: { "rustdoc-theme": "ayu" }
click: "#theme-light"
// should be the light theme so let's check the color.
2022-11-13 14:37:42 -06:00
wait-for-css: ("body", { "background-color": |background_light| })
2022-05-11 16:11:31 -05:00
assert-local-storage: { "rustdoc-theme": "light" }
click: "#theme-dark"
// Should be the dark theme so let's check the color.
2022-11-13 14:37:42 -06:00
wait-for-css: ("body", { "background-color": |background_dark| })
2022-05-11 16:11:31 -05:00
assert-local-storage: { "rustdoc-theme": "dark" }
2022-01-29 03:44:27 -06:00
set-local-storage: {
2022-11-13 14:37:42 -06:00
"rustdoc-preferred-light-theme": "light",
"rustdoc-preferred-dark-theme": "light",
}
go-to: "file://" + |DOC_PATH| + "/settings.html"
2022-11-13 14:37:42 -06:00
2022-01-19 16:06:17 -06:00
wait-for: "#settings"
2022-01-29 03:44:27 -06:00
click: "#theme-light"
2022-11-13 14:37:42 -06:00
wait-for-css: ("body", { "background-color": |background_light| })
2022-01-29 03:44:27 -06:00
assert-local-storage: { "rustdoc-theme": "light" }
click: "#theme-dark"
2022-11-13 14:37:42 -06:00
wait-for-css: ("body", { "background-color": |background_dark| })
2022-01-29 03:44:27 -06:00
assert-local-storage: { "rustdoc-theme": "dark" }
click: "#theme-ayu"
2022-11-13 14:37:42 -06:00
wait-for-css: ("body", { "background-color": |background_ayu| })
2022-01-29 03:44:27 -06:00
assert-local-storage: { "rustdoc-theme": "ayu" }
2022-11-13 14:37:42 -06:00
assert-local-storage-false: { "rustdoc-use-system-theme": "true" }
click: "#theme-system-preference"
wait-for: "#preferred-light-theme.setting-line:not(.hidden)"
2022-11-13 14:37:42 -06:00
assert-local-storage: { "rustdoc-use-system-theme": "true" }
// We click on both preferred light and dark themes to be sure that there is a change.
click: "#preferred-light-theme-dark"
click: "#preferred-dark-theme-dark"
wait-for-css: ("body", { "background-color": |background_dark| })
reload:
// Ensure that the "preferred themes" are still displayed.
wait-for: "#preferred-light-theme.setting-line:not(.hidden)"
2022-11-13 14:37:42 -06:00
click: "#theme-light"
wait-for-css: ("body", { "background-color": |background_light| })
assert-local-storage: { "rustdoc-theme": "light" }
// Ensure it's now hidden again
wait-for: "#preferred-light-theme.setting-line.hidden"
2022-11-13 14:37:42 -06:00
// And ensure the theme was rightly set.
wait-for-css: ("body", { "background-color": |background_light| })
assert-local-storage: { "rustdoc-theme": "light" }
reload:
wait-for: "#settings"
assert: "#preferred-light-theme.setting-line.hidden"