]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-gui/sidebar-source-code-display.goml
Rollup merge of #97743 - RalfJung:const-err-future-breakage, r=estebank
[rust.git] / src / test / rustdoc-gui / sidebar-source-code-display.goml
1 // This test ensures that the elements in the sidebar are displayed correctly.
2 javascript: false
3 goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
4 // Since the javascript is disabled, there shouldn't be a toggle.
5 assert-false: "#sidebar-toggle"
6 // For some reason, we need to wait a bit here because it seems like the transition on opacity
7 // is being applied whereas it can't be reproduced in a browser...
8 wait-for-css: (".sidebar > *", {"visibility": "hidden", "opacity": 0})
9
10 // Let's retry with javascript enabled.
11 javascript: true
12 reload:
13 wait-for: "#sidebar-toggle"
14 assert-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
15 assert-css: (".sidebar > *:not(#sidebar-toggle)", {"visibility": "hidden", "opacity": 0})
16 // Let's expand the sidebar now.
17 click: "#sidebar-toggle"
18 // Because of the transition CSS, we check by using `wait-for-css` instead of `assert-css`.
19 wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
20
21 // Now we check the display of the sidebar items.
22 show-text: true
23
24 // First we start with the light theme.
25 local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
26 reload:
27 // Waiting for the sidebar to be displayed...
28 wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
29 assert-css: (
30     "#source-sidebar .expand + .children a.selected",
31     {"color": "rgb(0, 0, 0)", "background-color": "rgb(255, 255, 255)"},
32 )
33 // Without hover.
34 assert-css: (
35     "#source-sidebar .expand + .children > .files a:not(.selected)",
36     {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
37 )
38 // With hover.
39 move-cursor-to: "#source-sidebar .expand + .children > .files a:not(.selected)"
40 assert-css: (
41     "#source-sidebar .expand + .children > .files a:not(.selected)",
42     {"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"},
43 )
44 // Without hover.
45 assert-css: (
46     "#source-sidebar .expand + .children .folders .name",
47     {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
48 )
49 // With hover.
50 move-cursor-to: "#source-sidebar .expand + .children .folders .name"
51 assert-css: (
52     "#source-sidebar .expand + .children .folders .name",
53     {"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"},
54 )
55
56 // Now with the dark theme.
57 local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
58 reload:
59 // Waiting for the sidebar to be displayed...
60 wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
61 assert-css: (
62     "#source-sidebar .expand + .children a.selected",
63     {"color": "rgb(221, 221, 221)", "background-color": "rgb(51, 51, 51)"},
64 )
65 // Without hover.
66 assert-css: (
67     "#source-sidebar .expand + .children > .files a:not(.selected)",
68     {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
69 )
70 // With hover.
71 move-cursor-to: "#source-sidebar .expand + .children > .files a:not(.selected)"
72 assert-css: (
73     "#source-sidebar .expand + .children > .files a:not(.selected)",
74     {"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"},
75 )
76 // Without hover.
77 assert-css: (
78     "#source-sidebar .expand + .children .folders .name",
79     {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
80 )
81 // With hover.
82 move-cursor-to: "#source-sidebar .expand + .children .folders .name"
83 assert-css: (
84     "#source-sidebar .expand + .children .folders .name",
85     {"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"},
86 )
87
88 // And finally with the ayu theme.
89 local-storage: {"rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false"}
90 reload:
91 // Waiting for the sidebar to be displayed...
92 wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
93 assert-css: (
94     "#source-sidebar .expand + .children a.selected",
95     {"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
96 )
97 // Without hover.
98 assert-css: (
99     "#source-sidebar .expand + .children > .files a:not(.selected)",
100     {"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"},
101 )
102 // With hover.
103 move-cursor-to: "#source-sidebar .expand + .children > .files a:not(.selected)"
104 assert-css: (
105     "#source-sidebar .expand + .children > .files a:not(.selected)",
106     {"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
107 )
108 // Without hover.
109 assert-css: (
110     "#source-sidebar .expand + .children .folders .name",
111     {"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"},
112 )
113 // With hover.
114 move-cursor-to: "#source-sidebar .expand + .children .folders .name"
115 assert-css: (
116     "#source-sidebar .expand + .children .folders .name",
117     {"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
118 )