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
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:
14 goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
16 assert-css: ("h1.fqn", {"font-size": "24px"})
18 assert-css: ("h2#top-doc-prose-title", {"font-size": "22px"})
19 assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"})
20 assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"})
21 assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"})
22 assert-css: ("h4#top-doc-prose-sub-sub-heading", {"font-size": "18px"})
23 assert-css: ("h4#top-doc-prose-sub-sub-heading", {"border-bottom-width": "1px"})
25 assert-css: ("h2#fields", {"font-size": "22px"})
26 assert-css: ("h2#fields", {"border-bottom-width": "1px"})
27 assert-css: ("h3#title-for-field", {"font-size": "20px"})
28 assert-css: ("h3#title-for-field", {"border-bottom-width": "0px"})
29 assert-css: ("h4#sub-heading-for-field", {"font-size": "16px"})
30 assert-css: ("h4#sub-heading-for-field", {"border-bottom-width": "0px"})
32 assert-css: ("h2#implementations", {"font-size": "22px"})
33 assert-css: ("h2#implementations", {"border-bottom-width": "1px"})
35 assert-css: ("#impl-HeavilyDocumentedStruct > h3.code-header", {"font-size": "18px"})
36 assert-css: ("#impl-HeavilyDocumentedStruct > h3.code-header", {"border-bottom-width": "0px"})
37 assert-css: ("#method\.do_nothing > h4.code-header", {"font-size": "16px"})
38 assert-css: ("#method\.do_nothing > h4.code-header", {"border-bottom-width": "0px"})
40 assert-css: ("h4#title-for-struct-impl-doc", {"font-size": "16px"})
41 assert-css: ("h4#title-for-struct-impl-doc", {"border-bottom-width": "0px"})
42 assert-css: ("h5#sub-heading-for-struct-impl-doc", {"font-size": "16px"})
43 assert-css: ("h5#sub-heading-for-struct-impl-doc", {"border-bottom-width": "0px"})
44 assert-css: ("h6#sub-sub-heading-for-struct-impl-doc", {"font-size": "14px"})
45 assert-css: ("h6#sub-sub-heading-for-struct-impl-doc", {"border-bottom-width": "0px"})
47 assert-css: ("h5#title-for-struct-impl-item-doc", {"font-size": "16px"})
48 assert-css: ("h5#title-for-struct-impl-item-doc", {"border-bottom-width": "0px"})
49 assert-css: ("h6#sub-heading-for-struct-impl-item-doc", {"font-size": "14px"})
50 assert-css: ("h6#sub-heading-for-struct-impl-item-doc", {"border-bottom-width": "0px"})
51 assert-css: ("h6#sub-sub-heading-for-struct-impl-item-doc", {"font-size": "14px"})
53 goto: file://|DOC_PATH|/test_docs/enum.HeavilyDocumentedEnum.html
55 assert-css: ("h1.fqn", {"font-size": "24px"})
57 assert-css: ("h2#top-doc-prose-title", {"font-size": "22px"})
58 assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"})
59 assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"})
60 assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"})
61 assert-css: ("h4#top-doc-prose-sub-sub-heading", {"font-size": "18px"})
62 assert-css: ("h4#top-doc-prose-sub-sub-heading", {"border-bottom-width": "1px"})
64 assert-css: ("h2#variants", {"font-size": "22px"})
65 assert-css: ("h2#variants", {"border-bottom-width": "1px"})
67 assert-css: ("h4#none-prose-title", {"font-size": "16px"})
68 assert-css: ("h4#none-prose-title", {"border-bottom-width": "0px"})
69 assert-css: ("h5#none-prose-sub-heading", {"font-size": "16px"})
70 assert-css: ("h5#none-prose-sub-heading", {"border-bottom-width": "0px"})
72 assert-css: ("h4#wrapped-prose-title", {"font-size": "16px"})
73 assert-css: ("h4#wrapped-prose-title", {"border-bottom-width": "0px"})
74 assert-css: ("h5#wrapped-prose-sub-heading", {"font-size": "16px"})
75 assert-css: ("h5#wrapped-prose-sub-heading", {"border-bottom-width": "0px"})
77 assert-css: ("h5#wrapped0-prose-title", {"font-size": "16px"})
78 assert-css: ("h5#wrapped0-prose-title", {"border-bottom-width": "0px"})
79 assert-css: ("h6#wrapped0-prose-sub-heading", {"font-size": "14px"})
80 assert-css: ("h6#wrapped0-prose-sub-heading", {"border-bottom-width": "0px"})
82 assert-css: ("h5#structy-prose-title", {"font-size": "16px"})
83 assert-css: ("h5#structy-prose-title", {"border-bottom-width": "0px"})
84 assert-css: ("h6#structy-prose-sub-heading", {"font-size": "14px"})
85 assert-css: ("h6#structy-prose-sub-heading", {"border-bottom-width": "0px"})
87 assert-css: ("h2#implementations", {"font-size": "22px"})
88 assert-css: ("h2#implementations", {"border-bottom-width": "1px"})
90 assert-css: ("#impl-HeavilyDocumentedEnum > h3.code-header", {"font-size": "18px"})
91 assert-css: ("#impl-HeavilyDocumentedEnum > h3.code-header", {"border-bottom-width": "0px"})
92 assert-css: ("#method\.do_nothing > h4.code-header", {"font-size": "16px"})
93 assert-css: ("#method\.do_nothing > h4.code-header", {"border-bottom-width": "0px"})
95 assert-css: ("h4#title-for-enum-impl-doc", {"font-size": "16px"})
96 assert-css: ("h4#title-for-enum-impl-doc", {"border-bottom-width": "0px"})
97 assert-css: ("h5#sub-heading-for-enum-impl-doc", {"font-size": "16px"})
98 assert-css: ("h5#sub-heading-for-enum-impl-doc", {"border-bottom-width": "0px"})
99 assert-css: ("h6#sub-sub-heading-for-enum-impl-doc", {"font-size": "14px"})
100 assert-css: ("h6#sub-sub-heading-for-enum-impl-doc", {"border-bottom-width": "0px"})
102 assert-css: ("h5#title-for-enum-impl-item-doc", {"font-size": "16px"})
103 assert-css: ("h5#title-for-enum-impl-item-doc", {"border-bottom-width": "0px"})
104 assert-css: ("h6#sub-heading-for-enum-impl-item-doc", {"font-size": "14px"})
105 assert-css: ("h6#sub-heading-for-enum-impl-item-doc", {"border-bottom-width": "0px"})
106 assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"font-size": "14px"})
107 assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"border-bottom-width": "0px"})
109 assert-text: (".sidebar .mod h3", "Modules")
110 assert-css: (".sidebar .mod h3", {"border-bottom-width": "0px"}, ALL)
112 goto: file://|DOC_PATH|/test_docs/union.HeavilyDocumentedUnion.html
114 assert-css: ("h1.fqn", {"font-size": "24px"})
116 assert-css: ("h2#top-doc-prose-title", {"font-size": "22px"})
117 assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"})
118 assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"})
119 assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"})
121 assert-css: ("h2#fields", {"font-size": "22px"})
122 assert-css: ("h2#fields", {"border-bottom-width": "1px"})
124 assert-css: ("h3#title-for-union-variant", {"font-size": "20px"})
125 assert-css: ("h3#title-for-union-variant", {"border-bottom-width": "0px"})
126 assert-css: ("h4#sub-heading-for-union-variant", {"font-size": "16px"})
127 assert-css: ("h4#sub-heading-for-union-variant", {"border-bottom-width": "0px"})
129 assert-css: ("h2#implementations", {"font-size": "22px"})
130 assert-css: ("h2#implementations", {"border-bottom-width": "1px"})
132 assert-css: ("#impl-HeavilyDocumentedUnion > h3.code-header", {"font-size": "18px"})
133 assert-css: ("#impl-HeavilyDocumentedUnion > h3.code-header", {"border-bottom-width": "0px"})
134 assert-css: ("h4#title-for-union-impl-doc", {"font-size": "16px"})
135 assert-css: ("h4#title-for-union-impl-doc", {"border-bottom-width": "0px"})
136 assert-css: ("h5#sub-heading-for-union-impl-doc", {"font-size": "16px"})
137 assert-css: ("h5#sub-heading-for-union-impl-doc", {"border-bottom-width": "0px"})
139 assert-css: ("h5#title-for-union-impl-item-doc", {"font-size": "16px"})
140 assert-css: ("h5#title-for-union-impl-item-doc", {"border-bottom-width": "0px"})
141 assert-css: ("h6#sub-heading-for-union-impl-item-doc", {"font-size": "14px"})
142 assert-css: ("h6#sub-heading-for-union-impl-item-doc", {"border-bottom-width": "0px"})
144 goto: file://|DOC_PATH|/test_docs/macro.heavily_documented_macro.html
146 assert-css: ("h1.fqn", {"font-size": "24px"})
148 assert-css: ("h2#top-doc-prose-title", {"font-size": "22px"})
149 assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"})
150 assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"})
151 assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"})
153 // Checking colors now.
155 local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
156 goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
158 ".top-doc .docblock h2",
159 {"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"},
162 ".top-doc .docblock h3",
163 {"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"},
166 ".top-doc .docblock h4",
167 {"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"},
170 ".top-doc .docblock h5",
171 {"color": "rgb(0, 0, 0)", "border-bottom-width": "0px"},
174 "#implementations-list .docblock h4",
175 {"color": "rgb(0, 0, 0)", "border-bottom-width": "0px"},
178 "#implementations-list .docblock h5",
179 {"color": "rgb(0, 0, 0)", "border-bottom-width": "0px"},
182 "#implementations-list .docblock h6",
183 {"color": "rgb(0, 0, 0)", "border-bottom-width": "0px"},
186 local-storage: {"rustdoc-theme": "dark"}
189 ".top-doc .docblock h2",
190 {"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"},
193 ".top-doc .docblock h3",
194 {"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"},
197 ".top-doc .docblock h4",
198 {"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"},
201 ".top-doc .docblock h5",
202 {"color": "rgb(221, 221, 221)", "border-bottom-width": "0px"},
205 "#implementations-list .docblock h4",
206 {"color": "rgb(221, 221, 221)", "border-bottom-width": "0px"},
209 "#implementations-list .docblock h5",
210 {"color": "rgb(221, 221, 221)", "border-bottom-width": "0px"},
213 "#implementations-list .docblock h6",
214 {"color": "rgb(221, 221, 221)", "border-bottom-width": "0px"},
217 local-storage: {"rustdoc-theme": "ayu"}
220 ".top-doc .docblock h2",
221 {"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"},
224 ".top-doc .docblock h2",
225 {"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"},
228 ".top-doc .docblock h4",
229 {"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"},
232 ".top-doc .docblock h5",
233 {"color": "rgb(197, 197, 197)", "border-bottom-width": "0px"},
236 "#implementations-list .docblock h4",
237 {"color": "rgb(255, 255, 255)", "border-bottom-width": "0px"},
240 "#implementations-list .docblock h5",
241 {"color": "rgb(197, 197, 197)", "border-bottom-width": "0px"},
244 "#implementations-list .docblock h6",
245 {"color": "rgb(197, 197, 197)", "border-bottom-width": "0px"},
248 local-storage: {"rustdoc-theme": "light"}
249 goto: file://|DOC_PATH|/staged_api/struct.Foo.html
250 assert-css: (".since", {"color": "rgb(128, 128, 128)"}, ALL)
252 local-storage: {"rustdoc-theme": "dark"}
254 assert-css: (".since", {"color": "rgb(128, 128, 128)"}, ALL)
256 local-storage: {"rustdoc-theme": "ayu"}
258 assert-css: (".since", {"color": "rgb(128, 128, 128)"}, ALL)