fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
5.7 KiB171 linesraw
1// This test checks links colors in sidebar before and after hover.
2go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
3
4// This is needed so that the text color is computed.
5show-text: true
6
7define-function: (
8    "check-colors",
9    (
10        theme, struct, struct_hover, struct_hover_background, enum, enum_hover,
11        enum_hover_background, union, union_hover, union_hover_background, trait, trait_hover,
12        trait_hover_background, fn, fn_hover, fn_hover_background, type, type_hover,
13        type_hover_background, keyword, keyword_hover, keyword_hover_background,
14    ),
15    block {
16        set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false" }
17        reload:
18        // Struct
19        assert-css: (
20            ".sidebar .block.struct a:not(.current)",
21            {"color": |struct|, "background-color": "rgba(0, 0, 0, 0)"},
22        )
23        move-cursor-to: ".sidebar .block.struct a:not(.current)"
24        assert-css: (
25            ".sidebar .block.struct a:hover",
26            {"color": |struct_hover|, "background-color": |struct_hover_background|},
27        )
28        // Enum
29        assert-css: (
30            ".sidebar .block.enum a",
31            {"color": |enum|, "background-color": "rgba(0, 0, 0, 0)"},
32        )
33        move-cursor-to: ".sidebar .block.enum a"
34        assert-css: (
35            ".sidebar .block.enum a:hover",
36            {"color": |enum_hover|, "background-color": |enum_hover_background|},
37        )
38        // Union
39        assert-css: (
40            ".sidebar .block.union a",
41            {"color": |union|, "background-color": "rgba(0, 0, 0, 0)"},
42        )
43        move-cursor-to: ".sidebar .block.union a"
44        assert-css: (
45            ".sidebar .block.union a:hover",
46            {"color": |union_hover|, "background-color": |union_hover_background|},
47        )
48        // Trait
49        assert-css: (
50            ".sidebar .block.trait a",
51            {"color": |trait|, "background-color": "rgba(0, 0, 0, 0)"},
52        )
53        move-cursor-to: ".sidebar .block.trait a"
54        assert-css: (
55            ".sidebar .block.trait a:hover",
56            {"color": |trait_hover|, "background-color": |trait_hover_background|},
57        )
58        // Function
59        assert-css: (
60            ".sidebar .block.fn a",
61            {"color": |fn|, "background-color": "rgba(0, 0, 0, 0)"},
62        )
63        move-cursor-to: ".sidebar .block.fn a"
64        assert-css: (
65            ".sidebar .block.fn a:hover",
66            {"color": |fn_hover|, "background-color": |fn_hover_background|},
67        )
68        // Type definition
69        assert-css: (
70            ".sidebar .block.type a",
71            {"color": |type|, "background-color": "rgba(0, 0, 0, 0)"},
72        )
73        move-cursor-to: ".sidebar .block.type a"
74        assert-css: (
75            ".sidebar .block.type a:hover",
76            {"color": |type_hover|, "background-color": |type_hover_background|},
77        )
78        // Keyword
79        assert-css: (
80            ".sidebar .block.keyword a",
81            {"color": |keyword|, "background-color": "rgba(0, 0, 0, 0)"},
82        )
83        move-cursor-to: ".sidebar .block.keyword a"
84        assert-css: (
85            ".sidebar .block.keyword a:hover",
86            {"color": |keyword_hover|, "background-color": |keyword_hover_background|},
87        )
88    }
89)
90
91call-function: (
92    "check-colors",
93    {
94        "theme": "ayu",
95        "struct": "#53b1db",
96        "struct_hover": "#ffb44c",
97        "struct_hover_background": "transparent",
98        "enum": "#53b1db",
99        "enum_hover": "#ffb44c",
100        "enum_hover_background": "transparent",
101        "union": "#53b1db",
102        "union_hover": "#ffb44c",
103        "union_hover_background": "transparent",
104        "trait": "#53b1db",
105        "trait_hover": "#ffb44c",
106        "trait_hover_background": "transparent",
107        "fn": "#53b1db",
108        "fn_hover": "#ffb44c",
109        "fn_hover_background": "transparent",
110        "type": "#53b1db",
111        "type_hover": "#ffb44c",
112        "type_hover_background": "transparent",
113        "keyword": "#53b1db",
114        "keyword_hover": "#ffb44c",
115        "keyword_hover_background": "transparent",
116    }
117)
118call-function: (
119    "check-colors",
120    {
121        "theme": "dark",
122        "struct": "#fdbf35",
123        "struct_hover": "#fdbf35",
124        "struct_hover_background": "#444",
125        "enum": "#fdbf35",
126        "enum_hover": "#fdbf35",
127        "enum_hover_background": "#444",
128        "union": "#fdbf35",
129        "union_hover": "#fdbf35",
130        "union_hover_background": "#444",
131        "trait": "#fdbf35",
132        "trait_hover": "#fdbf35",
133        "trait_hover_background": "#444",
134        "fn": "#fdbf35",
135        "fn_hover": "#fdbf35",
136        "fn_hover_background": "#444",
137        "type": "#fdbf35",
138        "type_hover": "#fdbf35",
139        "type_hover_background": "#444",
140        "keyword": "#fdbf35",
141        "keyword_hover": "#fdbf35",
142        "keyword_hover_background": "#444",
143    }
144)
145call-function: (
146    "check-colors",
147    {
148        "theme": "light",
149        "struct": "#356da4",
150        "struct_hover": "#356da4",
151        "struct_hover_background": "#fff",
152        "enum": "#356da4",
153        "enum_hover": "#356da4",
154        "enum_hover_background": "#fff",
155        "union": "#356da4",
156        "union_hover": "#356da4",
157        "union_hover_background": "#fff",
158        "trait": "#356da4",
159        "trait_hover": "#356da4",
160        "trait_hover_background": "#fff",
161        "fn": "#356da4",
162        "fn_hover": "#356da4",
163        "fn_hover_background": "#fff",
164        "type": "#356da4",
165        "type_hover": "#356da4",
166        "type_hover_background": "#fff",
167        "keyword": "#356da4",
168        "keyword_hover": "#356da4",
169        "keyword_hover_background": "#fff",
170    }
171)