1 // This test is to ensure that the anchors (`ยง`) have the expected color and position.
2 goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
5 // This is needed to ensure that the text color is computed.
8 // Set the theme to light.
9 local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
10 // We reload the page so the local storage settings are being used.
13 assert-css: ("#toggle-all-docs", {"color": "rgb(0, 0, 0)"})
14 assert-css: (".fqn .in-band a:nth-of-type(1)", {"color": "rgb(0, 0, 0)"})
15 assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgb(173, 68, 142)"})
16 assert-css: (".srclink", {"color": "rgb(0, 0, 0)"})
17 assert-css: (".srclink", {"color": "rgb(0, 0, 0)"})
19 assert-css: ("#top-doc-prose-title", {"color": "rgb(0, 0, 0)"})
21 assert-css: (".sidebar a", {"color": "rgb(0, 0, 0)"})
22 assert-css: (".in-band a", {"color": "rgb(0, 0, 0)"})
24 // We move the cursor over the "Implementations" title so the anchor is displayed.
25 move-cursor-to: "h2#implementations"
26 assert-css: ("h2#implementations a.anchor", {"color": "rgb(0, 0, 0)"})
28 // Same thing with the impl block title.
29 move-cursor-to: "#impl"
30 assert-css: ("#impl a.anchor", {"color": "rgb(0, 0, 0)"})
32 // Now we check the positions: only the first heading of the top doc comment should
33 // have a different position.
34 move-cursor-to: ".top-doc .docblock .section-header:first-child"
36 ".top-doc .docblock .section-header:first-child > a::before",
37 {"left": "-10px", "padding-right": "10px"}
39 // We also check that the heading itself has a different indent.
40 assert-css: (".top-doc .docblock .section-header:first-child", {"margin-left": "15px"})
42 move-cursor-to: ".top-doc .docblock .section-header:not(:first-child)"
44 ".top-doc .docblock .section-header:not(:first-child) > a::before",
45 {"left": "-25px", "padding-right": "10px"}
47 assert-css: (".top-doc .docblock .section-header:not(:first-child)", {"margin-left": "0px"})
49 // Now let's check some other docblock headings...
50 // First the impl block docs.
51 move-cursor-to: "#title-for-struct-impl-doc"
53 "#title-for-struct-impl-doc > a::before",
54 {"left": "-25px", "padding-right": "10px"}
56 assert-css: ("#title-for-struct-impl-doc", {"margin-left": "0px"})
58 move-cursor-to: "#title-for-struct-impl-item-doc"
60 "#title-for-struct-impl-item-doc > a::before",
61 {"left": "-25px", "padding-right": "10px"}
63 assert-css: ("#title-for-struct-impl-item-doc", {"margin-left": "0px"})
65 // Finally, we want to ensure that if the first element of the doc block isn't a heading,
66 // if there is a heading afterwards, it won't have the indent.
67 goto: file://|DOC_PATH|/test_docs/enum.WhoLetTheDogOut.html
69 move-cursor-to: ".top-doc .docblock .section-header"
71 ".top-doc .docblock .section-header > a::before",
72 {"left": "-25px", "padding-right": "10px"}
74 assert-css: (".top-doc .docblock .section-header", {"margin-left": "0px"})