]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc-gui/links-color.goml
Merge commit '1d8491b120223272b13451fc81265aa64f7f4d5b' into sync-from-rustfmt
[rust.git] / tests / rustdoc-gui / links-color.goml
1 // This test checks links colors.
2 goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
3
4 // This is needed so that the text color is computed.
5 show-text: true
6
7 define-function: (
8     "check-colors",
9     (theme, mod, macro, struct, enum, trait, fn, type, union, keyword,
10      sidebar, sidebar_current, sidebar_current_background),
11     block {
12         local-storage: {
13             "rustdoc-theme": |theme|,
14             "rustdoc-use-system-theme": "false",
15         }
16         reload:
17         // Checking results colors.
18         assert-css: (".item-table .mod", {"color": |mod|}, ALL)
19         assert-css: (".item-table .macro", {"color": |macro|}, ALL)
20         assert-css: (".item-table .struct", {"color": |struct|}, ALL)
21         assert-css: (".item-table .enum", {"color": |enum|}, ALL)
22         assert-css: (".item-table .trait", {"color": |trait|}, ALL)
23         assert-css: (".item-table .fn", {"color": |fn|}, ALL)
24         assert-css: (".item-table .type", {"color": |type|}, ALL)
25         assert-css: (".item-table .union", {"color": |union|}, ALL)
26         assert-css: (".item-table .keyword", {"color": |keyword|}, ALL)
27         // Checking sidebar elements.
28         assert-css: (
29             ".sidebar-elems a:not(.current)",
30             {"color": |sidebar|, "background-color": "rgba(0, 0, 0, 0)", "font-weight": "400"},
31             ALL,
32         )
33         assert-css: (
34             ".sidebar-elems a.current",
35             {
36                 "color": |sidebar_current|,
37                 "background-color": |sidebar_current_background|,
38                 "font-weight": "500",
39             },
40             ALL,
41         )
42     },
43 )
44
45 call-function: (
46     "check-colors",
47     {
48         "theme": "ayu",
49         "mod": "rgb(57, 175, 215)",
50         "macro": "rgb(163, 122, 204)",
51         "struct": "rgb(255, 160, 165)",
52         "enum": "rgb(255, 160, 165)",
53         "trait": "rgb(57, 175, 215)",
54         "fn": "rgb(253, 214, 135)",
55         "type": "rgb(255, 160, 165)",
56         "union": "rgb(255, 160, 165)",
57         "keyword": "rgb(57, 175, 215)",
58         "sidebar": "rgb(83, 177, 219)",
59         "sidebar_current": "rgb(255, 180, 76)",
60         "sidebar_current_background": "rgba(0, 0, 0, 0)",
61     },
62 )
63 call-function: (
64     "check-colors",
65     {
66         "theme": "dark",
67         "mod": "rgb(210, 153, 29)",
68         "macro": "rgb(9, 189, 0)",
69         "struct": "rgb(45, 191, 184)",
70         "enum": "rgb(45, 191, 184)",
71         "trait": "rgb(183, 140, 242)",
72         "fn": "rgb(43, 171, 99)",
73         "type": "rgb(45, 191, 184)",
74         "union": "rgb(45, 191, 184)",
75         "keyword": "rgb(210, 153, 29)",
76         "sidebar": "rgb(253, 191, 53)",
77         "sidebar_current": "rgb(253, 191, 53)",
78         "sidebar_current_background": "rgb(68, 68, 68)",
79     },
80 )
81 call-function: (
82     "check-colors",
83     {
84         "theme": "light",
85         "mod": "rgb(56, 115, 173)",
86         "macro": "rgb(6, 128, 0)",
87         "struct": "rgb(173, 55, 138)",
88         "enum": "rgb(173, 55, 138)",
89         "trait": "rgb(110, 79, 201)",
90         "fn": "rgb(173, 124, 55)",
91         "type": "rgb(173, 55, 138)",
92         "union": "rgb(173, 55, 138)",
93         "keyword": "rgb(56, 115, 173)",
94         "sidebar": "rgb(53, 109, 164)",
95         "sidebar_current": "rgb(53, 109, 164)",
96         "sidebar_current_background": "rgb(255, 255, 255)",
97     },
98 )