]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc-gui/theme-change.goml
Extend `BYTE_SLICE_IN_PACKED_STRUCT_WITH_DERIVE`.
[rust.git] / tests / rustdoc-gui / theme-change.goml
1 // Ensures that the theme change is working as expected.
2 goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
3 local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "dark"}
4 reload:
5
6 store-value: (background_light, "rgb(255, 255, 255)")
7 store-value: (background_dark, "rgb(53, 53, 53)")
8 store-value: (background_ayu, "rgb(15, 20, 25)")
9
10 click: "#settings-menu"
11 wait-for: "#theme-ayu"
12 click: "#theme-ayu"
13 // should be the ayu theme so let's check the color.
14 wait-for-css: ("body", { "background-color": |background_ayu| })
15 assert-local-storage: { "rustdoc-theme": "ayu" }
16 click: "#theme-light"
17 // should be the light theme so let's check the color.
18 wait-for-css: ("body", { "background-color": |background_light| })
19 assert-local-storage: { "rustdoc-theme": "light" }
20 click: "#theme-dark"
21 // Should be the dark theme so let's check the color.
22 wait-for-css: ("body", { "background-color": |background_dark| })
23 assert-local-storage: { "rustdoc-theme": "dark" }
24
25 local-storage: {
26     "rustdoc-preferred-light-theme": "light",
27     "rustdoc-preferred-dark-theme": "light",
28 }
29 goto: "file://" + |DOC_PATH| + "/settings.html"
30
31 wait-for: "#settings"
32 click: "#theme-light"
33 wait-for-css: ("body", { "background-color": |background_light| })
34 assert-local-storage: { "rustdoc-theme": "light" }
35
36 click: "#theme-dark"
37 wait-for-css: ("body", { "background-color": |background_dark| })
38 assert-local-storage: { "rustdoc-theme": "dark" }
39
40 click: "#theme-ayu"
41 wait-for-css: ("body", { "background-color": |background_ayu| })
42 assert-local-storage: { "rustdoc-theme": "ayu" }
43
44 assert-local-storage-false: { "rustdoc-use-system-theme": "true" }
45 click: "#theme-system-preference"
46 wait-for: "#preferred-light-theme.setting-line:not(.hidden)"
47 assert-local-storage: { "rustdoc-use-system-theme": "true" }
48 // We click on both preferred light and dark themes to be sure that there is a change.
49 click: "#preferred-light-theme-dark"
50 click: "#preferred-dark-theme-dark"
51 wait-for-css: ("body", { "background-color": |background_dark| })
52
53 reload:
54 // Ensure that the "preferred themes" are still displayed.
55 wait-for: "#preferred-light-theme.setting-line:not(.hidden)"
56 click: "#theme-light"
57 wait-for-css: ("body", { "background-color": |background_light| })
58 assert-local-storage: { "rustdoc-theme": "light" }
59 // Ensure it's now hidden again
60 wait-for: "#preferred-light-theme.setting-line.hidden"
61 // And ensure the theme was rightly set.
62 wait-for-css: ("body", { "background-color": |background_light| })
63 assert-local-storage: { "rustdoc-theme": "light" }
64
65 reload:
66 wait-for: "#settings"
67 assert: "#preferred-light-theme.setting-line.hidden"