diff options
| -rw-r--r-- | src/librustdoc/html/markdown/tests.rs | 41 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/anchors.goml | 42 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/headers-color.goml | 9 |
3 files changed, 13 insertions, 79 deletions
diff --git a/src/librustdoc/html/markdown/tests.rs b/src/librustdoc/html/markdown/tests.rs index 6b44e447b51..5c0bf0ed942 100644 --- a/src/librustdoc/html/markdown/tests.rs +++ b/src/librustdoc/html/markdown/tests.rs @@ -159,10 +159,7 @@ fn test_header() { assert_eq!(output, expect, "original: {}", input); } - t( - "# Foo bar", - "<h2 id=\"foo-bar\"><a href=\"#foo-bar\">Foo bar</a></h2>", - ); + t("# Foo bar", "<h2 id=\"foo-bar\"><a href=\"#foo-bar\">Foo bar</a></h2>"); t( "## Foo-bar_baz qux", "<h3 id=\"foo-bar_baz-qux\">\ @@ -201,36 +198,12 @@ fn test_header_ids_multiple_blocks() { assert_eq!(output, expect, "original: {}", input); } - t( - &mut map, - "# Example", - "<h2 id=\"example\"><a href=\"#example\">Example</a></h2>", - ); - t( - &mut map, - "# Panics", - "<h2 id=\"panics\"><a href=\"#panics\">Panics</a></h2>", - ); - t( - &mut map, - "# Example", - "<h2 id=\"example-1\"><a href=\"#example-1\">Example</a></h2>", - ); - t( - &mut map, - "# Search", - "<h2 id=\"search-1\"><a href=\"#search-1\">Search</a></h2>", - ); - t( - &mut map, - "# Example", - "<h2 id=\"example-2\"><a href=\"#example-2\">Example</a></h2>", - ); - t( - &mut map, - "# Panics", - "<h2 id=\"panics-1\"><a href=\"#panics-1\">Panics</a></h2>", - ); + t(&mut map, "# Example", "<h2 id=\"example\"><a href=\"#example\">Example</a></h2>"); + t(&mut map, "# Panics", "<h2 id=\"panics\"><a href=\"#panics\">Panics</a></h2>"); + t(&mut map, "# Example", "<h2 id=\"example-1\"><a href=\"#example-1\">Example</a></h2>"); + t(&mut map, "# Search", "<h2 id=\"search-1\"><a href=\"#search-1\">Search</a></h2>"); + t(&mut map, "# Example", "<h2 id=\"example-2\"><a href=\"#example-2\">Example</a></h2>"); + t(&mut map, "# Panics", "<h2 id=\"panics-1\"><a href=\"#panics-1\">Panics</a></h2>"); } #[test] diff --git a/src/test/rustdoc-gui/anchors.goml b/src/test/rustdoc-gui/anchors.goml index 26e4503a5d0..ddfb23a4f86 100644 --- a/src/test/rustdoc-gui/anchors.goml +++ b/src/test/rustdoc-gui/anchors.goml @@ -31,46 +31,4 @@ assert-css: ("h2#implementations a.anchor", {"color": "rgb(0, 0, 0)"}) move-cursor-to: "#impl" assert-css: ("#impl a.anchor", {"color": "rgb(0, 0, 0)"}) -// Now we check the positions: only the first heading of the top doc comment should -// have a different position. -move-cursor-to: ".top-doc .docblock .section-header:first-child" -assert-css: ( - ".top-doc .docblock .section-header:first-child > a::before", - {"left": "-10px", "padding-right": "10px"}, -) -// We also check that the heading itself has a different indent. -assert-css: (".top-doc .docblock .section-header:first-child", {"margin-left": "15px"}) - -move-cursor-to: ".top-doc .docblock .section-header:not(:first-child)" -assert-css: ( - ".top-doc .docblock .section-header:not(:first-child) > a::before", - {"left": "-25px", "padding-right": "10px"}, -) -assert-css: (".top-doc .docblock .section-header:not(:first-child)", {"margin-left": "0px"}) - -// Now let's check some other docblock headings... -// First the impl block docs. -move-cursor-to: "#title-for-struct-impl-doc" -assert-css: ( - "#title-for-struct-impl-doc > a::before", - {"left": "-25px", "padding-right": "10px"}, -) -assert-css: ("#title-for-struct-impl-doc", {"margin-left": "0px"}) -// Now a method docs. -move-cursor-to: "#title-for-struct-impl-item-doc" -assert-css: ( - "#title-for-struct-impl-item-doc > a::before", - {"left": "-25px", "padding-right": "10px"}, -) assert-css: ("#title-for-struct-impl-item-doc", {"margin-left": "0px"}) - -// Finally, we want to ensure that if the first element of the doc block isn't a heading, -// if there is a heading afterwards, it won't have the indent. -goto: file://|DOC_PATH|/test_docs/enum.WhoLetTheDogOut.html - -move-cursor-to: ".top-doc .docblock .section-header" -assert-css: ( - ".top-doc .docblock .section-header > a::before", - {"left": "-25px", "padding-right": "10px"}, -) -assert-css: (".top-doc .docblock .section-header", {"margin-left": "0px"}) diff --git a/src/test/rustdoc-gui/headers-color.goml b/src/test/rustdoc-gui/headers-color.goml index d58ca13a629..cf9caa2d586 100644 --- a/src/test/rustdoc-gui/headers-color.goml +++ b/src/test/rustdoc-gui/headers-color.goml @@ -40,7 +40,8 @@ goto: file://|DOC_PATH|/test_docs/index.html assert-css: (".small-section-header a", {"color": "rgb(197, 197, 197)"}, ALL) goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html -assert-css: (".section-header a", {"color": "rgb(57, 175, 215)"}, ALL) +// We select headings (h2, h3, h...). +assert-css: (".docblock > :not(p) > a", {"color": "rgb(57, 175, 215)"}, ALL) // Dark theme local-storage: { @@ -78,7 +79,8 @@ goto: file://|DOC_PATH|/test_docs/index.html assert-css: (".small-section-header a", {"color": "rgb(221, 221, 221)"}, ALL) goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html -assert-css: (".section-header a", {"color": "rgb(210, 153, 29)"}, ALL) +// We select headings (h2, h3, h...). +assert-css: (".docblock > :not(p) > a", {"color": "rgb(210, 153, 29)"}, ALL) // Light theme local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} @@ -111,4 +113,5 @@ goto: file://|DOC_PATH|/test_docs/index.html assert-css: (".small-section-header a", {"color": "rgb(0, 0, 0)"}, ALL) goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html -assert-css: (".section-header a", {"color": "rgb(56, 115, 173)"}, ALL) +// We select headings (h2, h3, h...). +assert-css: (".docblock > :not(p) > a", {"color": "rgb(56, 115, 173)"}, ALL) |
