]> git.proxmox.com Git - rustc.git/blame - tests/rustdoc-gui/headings.goml
Update upstream source from tag 'upstream/1.70.0+dfsg1'
[rustc.git] / tests / rustdoc-gui / headings.goml
CommitLineData
3c0e092e
XL
1// This test checks that headers (a) have the correct heading level, (b) are the right size,
2// and (c) have the correct underlining (or absence of underlining).
3// The sizes may change as design changes, but try to make sure a lower header is never bigger than
4// its parent headers. Also make sure lower headers don't have underlines when their parents lack
5// an underline.
6// Most of these sizes are set in CSS in `em` units, so here's a conversion chart based on our
7// default 16px font size:
8// 24px 1.5em
5099ac24
FG
9// 22px 1.375rem
10// 20px 1.25rem
11// 18px 1.125em
12// 16px 1rem
13// 14px 0.875rem
353b0b11 14go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
3c0e092e 15
9c376795 16assert-css: (".main-heading h1", {"font-size": "24px"})
3c0e092e 17
5099ac24 18assert-css: ("h2#top-doc-prose-title", {"font-size": "22px"})
3c0e092e 19assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"})
5099ac24 20assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"})
3c0e092e 21assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"})
5099ac24 22assert-css: ("h4#top-doc-prose-sub-sub-heading", {"font-size": "18px"})
3c0e092e
XL
23assert-css: ("h4#top-doc-prose-sub-sub-heading", {"border-bottom-width": "1px"})
24
5099ac24 25assert-css: ("h2#fields", {"font-size": "22px"})
3c0e092e 26assert-css: ("h2#fields", {"border-bottom-width": "1px"})
5099ac24 27assert-css: ("h3#title-for-field", {"font-size": "20px"})
3c0e092e
XL
28assert-css: ("h3#title-for-field", {"border-bottom-width": "0px"})
29assert-css: ("h4#sub-heading-for-field", {"font-size": "16px"})
30assert-css: ("h4#sub-heading-for-field", {"border-bottom-width": "0px"})
31
5099ac24 32assert-css: ("h2#implementations", {"font-size": "22px"})
3c0e092e
XL
33assert-css: ("h2#implementations", {"border-bottom-width": "1px"})
34
064997fb
FG
35assert-css: ("#impl-HeavilyDocumentedStruct > h3.code-header", {"font-size": "18px"})
36assert-css: ("#impl-HeavilyDocumentedStruct > h3.code-header", {"border-bottom-width": "0px"})
3c0e092e
XL
37assert-css: ("#method\.do_nothing > h4.code-header", {"font-size": "16px"})
38assert-css: ("#method\.do_nothing > h4.code-header", {"border-bottom-width": "0px"})
39
40assert-css: ("h4#title-for-struct-impl-doc", {"font-size": "16px"})
41assert-css: ("h4#title-for-struct-impl-doc", {"border-bottom-width": "0px"})
42assert-css: ("h5#sub-heading-for-struct-impl-doc", {"font-size": "16px"})
43assert-css: ("h5#sub-heading-for-struct-impl-doc", {"border-bottom-width": "0px"})
5099ac24 44assert-css: ("h6#sub-sub-heading-for-struct-impl-doc", {"font-size": "14px"})
3c0e092e
XL
45assert-css: ("h6#sub-sub-heading-for-struct-impl-doc", {"border-bottom-width": "0px"})
46
47assert-css: ("h5#title-for-struct-impl-item-doc", {"font-size": "16px"})
48assert-css: ("h5#title-for-struct-impl-item-doc", {"border-bottom-width": "0px"})
5099ac24 49assert-css: ("h6#sub-heading-for-struct-impl-item-doc", {"font-size": "14px"})
3c0e092e 50assert-css: ("h6#sub-heading-for-struct-impl-item-doc", {"border-bottom-width": "0px"})
5099ac24 51assert-css: ("h6#sub-sub-heading-for-struct-impl-item-doc", {"font-size": "14px"})
3c0e092e 52
353b0b11 53go-to: "file://" + |DOC_PATH| + "/test_docs/enum.HeavilyDocumentedEnum.html"
3c0e092e 54
9c376795 55assert-css: (".main-heading h1", {"font-size": "24px"})
3c0e092e 56
5099ac24 57assert-css: ("h2#top-doc-prose-title", {"font-size": "22px"})
3c0e092e 58assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"})
5099ac24 59assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"})
3c0e092e 60assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"})
5099ac24 61assert-css: ("h4#top-doc-prose-sub-sub-heading", {"font-size": "18px"})
3c0e092e
XL
62assert-css: ("h4#top-doc-prose-sub-sub-heading", {"border-bottom-width": "1px"})
63
5099ac24 64assert-css: ("h2#variants", {"font-size": "22px"})
3c0e092e
XL
65assert-css: ("h2#variants", {"border-bottom-width": "1px"})
66
67assert-css: ("h4#none-prose-title", {"font-size": "16px"})
68assert-css: ("h4#none-prose-title", {"border-bottom-width": "0px"})
69assert-css: ("h5#none-prose-sub-heading", {"font-size": "16px"})
70assert-css: ("h5#none-prose-sub-heading", {"border-bottom-width": "0px"})
71
72assert-css: ("h4#wrapped-prose-title", {"font-size": "16px"})
73assert-css: ("h4#wrapped-prose-title", {"border-bottom-width": "0px"})
74assert-css: ("h5#wrapped-prose-sub-heading", {"font-size": "16px"})
75assert-css: ("h5#wrapped-prose-sub-heading", {"border-bottom-width": "0px"})
76
77assert-css: ("h5#wrapped0-prose-title", {"font-size": "16px"})
78assert-css: ("h5#wrapped0-prose-title", {"border-bottom-width": "0px"})
5099ac24 79assert-css: ("h6#wrapped0-prose-sub-heading", {"font-size": "14px"})
3c0e092e
XL
80assert-css: ("h6#wrapped0-prose-sub-heading", {"border-bottom-width": "0px"})
81
82assert-css: ("h5#structy-prose-title", {"font-size": "16px"})
83assert-css: ("h5#structy-prose-title", {"border-bottom-width": "0px"})
5099ac24 84assert-css: ("h6#structy-prose-sub-heading", {"font-size": "14px"})
3c0e092e
XL
85assert-css: ("h6#structy-prose-sub-heading", {"border-bottom-width": "0px"})
86
5099ac24 87assert-css: ("h2#implementations", {"font-size": "22px"})
3c0e092e
XL
88assert-css: ("h2#implementations", {"border-bottom-width": "1px"})
89
064997fb
FG
90assert-css: ("#impl-HeavilyDocumentedEnum > h3.code-header", {"font-size": "18px"})
91assert-css: ("#impl-HeavilyDocumentedEnum > h3.code-header", {"border-bottom-width": "0px"})
3c0e092e
XL
92assert-css: ("#method\.do_nothing > h4.code-header", {"font-size": "16px"})
93assert-css: ("#method\.do_nothing > h4.code-header", {"border-bottom-width": "0px"})
94
95assert-css: ("h4#title-for-enum-impl-doc", {"font-size": "16px"})
96assert-css: ("h4#title-for-enum-impl-doc", {"border-bottom-width": "0px"})
97assert-css: ("h5#sub-heading-for-enum-impl-doc", {"font-size": "16px"})
98assert-css: ("h5#sub-heading-for-enum-impl-doc", {"border-bottom-width": "0px"})
5099ac24 99assert-css: ("h6#sub-sub-heading-for-enum-impl-doc", {"font-size": "14px"})
3c0e092e
XL
100assert-css: ("h6#sub-sub-heading-for-enum-impl-doc", {"border-bottom-width": "0px"})
101
102assert-css: ("h5#title-for-enum-impl-item-doc", {"font-size": "16px"})
103assert-css: ("h5#title-for-enum-impl-item-doc", {"border-bottom-width": "0px"})
5099ac24 104assert-css: ("h6#sub-heading-for-enum-impl-item-doc", {"font-size": "14px"})
3c0e092e 105assert-css: ("h6#sub-heading-for-enum-impl-item-doc", {"border-bottom-width": "0px"})
5099ac24 106assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"font-size": "14px"})
3c0e092e
XL
107assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"border-bottom-width": "0px"})
108
2b03887a
FG
109assert-text: ("//ul[@class='block mod']/preceding-sibling::h3", "Modules")
110assert-css: ("//ul[@class='block mod']/preceding-sibling::h3", {"border-bottom-width": "0px"}, ALL)
3c0e092e 111
353b0b11 112go-to: "file://" + |DOC_PATH| + "/test_docs/union.HeavilyDocumentedUnion.html"
3c0e092e 113
9c376795 114assert-css: (".main-heading h1", {"font-size": "24px"})
3c0e092e 115
5099ac24 116assert-css: ("h2#top-doc-prose-title", {"font-size": "22px"})
3c0e092e 117assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"})
5099ac24 118assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"})
3c0e092e
XL
119assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"})
120
5099ac24 121assert-css: ("h2#fields", {"font-size": "22px"})
3c0e092e
XL
122assert-css: ("h2#fields", {"border-bottom-width": "1px"})
123
5099ac24 124assert-css: ("h3#title-for-union-variant", {"font-size": "20px"})
3c0e092e
XL
125assert-css: ("h3#title-for-union-variant", {"border-bottom-width": "0px"})
126assert-css: ("h4#sub-heading-for-union-variant", {"font-size": "16px"})
127assert-css: ("h4#sub-heading-for-union-variant", {"border-bottom-width": "0px"})
128
5099ac24 129assert-css: ("h2#implementations", {"font-size": "22px"})
3c0e092e
XL
130assert-css: ("h2#implementations", {"border-bottom-width": "1px"})
131
064997fb
FG
132assert-css: ("#impl-HeavilyDocumentedUnion > h3.code-header", {"font-size": "18px"})
133assert-css: ("#impl-HeavilyDocumentedUnion > h3.code-header", {"border-bottom-width": "0px"})
3c0e092e
XL
134assert-css: ("h4#title-for-union-impl-doc", {"font-size": "16px"})
135assert-css: ("h4#title-for-union-impl-doc", {"border-bottom-width": "0px"})
136assert-css: ("h5#sub-heading-for-union-impl-doc", {"font-size": "16px"})
137assert-css: ("h5#sub-heading-for-union-impl-doc", {"border-bottom-width": "0px"})
138
139assert-css: ("h5#title-for-union-impl-item-doc", {"font-size": "16px"})
140assert-css: ("h5#title-for-union-impl-item-doc", {"border-bottom-width": "0px"})
5099ac24 141assert-css: ("h6#sub-heading-for-union-impl-item-doc", {"font-size": "14px"})
3c0e092e
XL
142assert-css: ("h6#sub-heading-for-union-impl-item-doc", {"border-bottom-width": "0px"})
143
353b0b11 144go-to: "file://" + |DOC_PATH| + "/test_docs/macro.heavily_documented_macro.html"
3c0e092e 145
9c376795 146assert-css: (".main-heading h1", {"font-size": "24px"})
3c0e092e 147
5099ac24 148assert-css: ("h2#top-doc-prose-title", {"font-size": "22px"})
3c0e092e 149assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"})
5099ac24 150assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"})
3c0e092e 151assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"})
5099ac24 152
2b03887a 153// Needed to check colors
5099ac24 154show-text: true
353b0b11 155go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
2b03887a
FG
156
157define-function: (
158 "check-colors",
159 (theme, heading_color, small_heading_color, heading_border_color),
9c376795 160 block {
353b0b11 161 set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
9c376795
FG
162 reload:
163 assert-css: (
2b03887a
FG
164 ".top-doc .docblock h2",
165 {"color": |heading_color|, "border-bottom": "1px solid " + |heading_border_color|},
9c376795
FG
166 )
167 assert-css: (
2b03887a
FG
168 ".top-doc .docblock h3",
169 {"color": |heading_color|, "border-bottom": "1px solid " + |heading_border_color|},
9c376795
FG
170 )
171 assert-css: (
2b03887a
FG
172 ".top-doc .docblock h4",
173 {"color": |heading_color|, "border-bottom": "1px solid " + |heading_border_color|},
9c376795
FG
174 )
175 assert-css: (
2b03887a
FG
176 ".top-doc .docblock h5",
177 {"color": |small_heading_color|, "border-bottom-width": "0px"},
9c376795
FG
178 )
179 assert-css: (
2b03887a
FG
180 "#implementations-list .docblock h4",
181 {"color": |heading_color|, "border-bottom-width": "0px"},
9c376795
FG
182 )
183 assert-css: (
2b03887a
FG
184 "#implementations-list .docblock h5",
185 {"color": |small_heading_color|, "border-bottom-width": "0px"},
9c376795
FG
186 )
187 assert-css: (
2b03887a
FG
188 "#implementations-list .docblock h6",
189 {"color": |small_heading_color|, "border-bottom-width": "0px"},
9c376795
FG
190 )
191 },
2b03887a
FG
192)
193call-function: (
194 "check-colors",
195 {
196 "theme": "ayu",
197 "heading_color": "rgb(255, 255, 255)",
198 "small_heading_color": "rgb(197, 197, 197)",
199 "heading_border_color": "rgb(92, 103, 115)",
200 },
201)
202call-function: (
203 "check-colors",
204 {
205 "theme": "dark",
206 "heading_color": "rgb(221, 221, 221)",
207 "small_heading_color": "rgb(221, 221, 221)",
208 "heading_border_color": "rgb(210, 210, 210)",
209 },
210)
211call-function: (
212 "check-colors",
213 {
214 "theme": "light",
215 "heading_color": "rgb(0, 0, 0)",
216 "small_heading_color": "rgb(0, 0, 0)",
217 "heading_border_color": "rgb(221, 221, 221)",
218 },
219)
220
221define-function: (
222 "check-since-color",
223 (theme),
9c376795 224 block {
353b0b11 225 set-local-storage: {"rustdoc-theme": |theme|}
9c376795
FG
226 reload:
227 assert-css: (".since", {"color": "rgb(128, 128, 128)"}, ALL)
228 },
2b03887a
FG
229)
230
353b0b11 231go-to: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html"
2b03887a
FG
232call-function: ("check-since-color", ("ayu"))
233call-function: ("check-since-color", ("dark"))
234call-function: ("check-since-color", ("light"))