diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index f9c5837b7d6..e4e4f938528 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1064,6 +1064,8 @@ fn run(self, builder: &Builder<'_>) { cargo.env("RUSTDOCFLAGS", "-Zunstable-options --generate-link-to-definition"); } else if entry.file_name() == "scrape_examples" { cargo.arg("-Zrustdoc-scrape-examples"); + } else if entry.file_name() == "extend_css" { + cargo.env("RUSTDOCFLAGS", &format!("--extend-css extra.css")); } builder.run(&mut cargo); } diff --git a/tests/rustdoc-gui/extend-css.goml b/tests/rustdoc-gui/extend-css.goml new file mode 100644 index 00000000000..fb34469df6c --- /dev/null +++ b/tests/rustdoc-gui/extend-css.goml @@ -0,0 +1,5 @@ +// Test to ensure that the `--extend-css` option is working as expected. +go-to: "file://" + |DOC_PATH| + "/extend_css/index.html" +show-text: true +// The text from the `.extend` element should be red. +assert-css: (".extend", {"color": "rgb(255, 0, 0)"}) diff --git a/tests/rustdoc-gui/search-filter.goml b/tests/rustdoc-gui/search-filter.goml index f114c57ff21..d739471a625 100644 --- a/tests/rustdoc-gui/search-filter.goml +++ b/tests/rustdoc-gui/search-filter.goml @@ -16,6 +16,7 @@ press-key: "ArrowDown" press-key: "ArrowDown" press-key: "ArrowDown" press-key: "ArrowDown" +press-key: "ArrowDown" press-key: "Enter" // Waiting for the search results to appear... wait-for: "#search-tabs" @@ -41,6 +42,7 @@ press-key: "ArrowUp" press-key: "ArrowUp" press-key: "ArrowUp" press-key: "ArrowUp" +press-key: "ArrowUp" press-key: "Enter" // Waiting for the search results to appear... wait-for: "#search-tabs" diff --git a/tests/rustdoc-gui/sidebar-source-code.goml b/tests/rustdoc-gui/sidebar-source-code.goml index 96ea7202433..520b2c59b0f 100644 --- a/tests/rustdoc-gui/sidebar-source-code.goml +++ b/tests/rustdoc-gui/sidebar-source-code.goml @@ -73,7 +73,7 @@ assert: "//*[@class='dir-entry' and @open]/*[text()='sub_mod']" // Only "another_folder" should be "open" in "lib2". assert: "//*[@class='dir-entry' and not(@open)]/*[text()='another_mod']" // All other trees should be collapsed. -assert-count: ("//*[@id='source-sidebar']/details[not(text()='lib2') and not(@open)]", 8) +assert-count: ("//*[@id='source-sidebar']/details[not(text()='lib2') and not(@open)]", 9) // We now switch to mobile mode. set-window-size: (600, 600) diff --git a/tests/rustdoc-gui/source-code-page.goml b/tests/rustdoc-gui/source-code-page.goml index 1ac403308eb..42f3200e967 100644 --- a/tests/rustdoc-gui/source-code-page.goml +++ b/tests/rustdoc-gui/source-code-page.goml @@ -102,7 +102,7 @@ assert: ".source-sidebar-expanded" // We check that the first entry of the sidebar is collapsed assert-property: ("#source-sidebar details:first-of-type", {"open": "false"}) -assert-text: ("#source-sidebar details:first-of-type > summary", "http") +assert-text: ("#source-sidebar details:first-of-type > summary", "extend_css") // We now click on it. click: "#source-sidebar details:first-of-type > summary" assert-property: ("#source-sidebar details:first-of-type", {"open": "true"}) diff --git a/tests/rustdoc-gui/src/extend_css/Cargo.lock b/tests/rustdoc-gui/src/extend_css/Cargo.lock new file mode 100644 index 00000000000..7101a6f0ffb --- /dev/null +++ b/tests/rustdoc-gui/src/extend_css/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "extend_css" +version = "0.1.0" diff --git a/tests/rustdoc-gui/src/extend_css/Cargo.toml b/tests/rustdoc-gui/src/extend_css/Cargo.toml new file mode 100644 index 00000000000..91683fe8964 --- /dev/null +++ b/tests/rustdoc-gui/src/extend_css/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "extend_css" +version = "0.1.0" +edition = "2018" + +[lib] +path = "lib.rs" diff --git a/tests/rustdoc-gui/src/extend_css/extra.css b/tests/rustdoc-gui/src/extend_css/extra.css new file mode 100644 index 00000000000..ee7062d9621 --- /dev/null +++ b/tests/rustdoc-gui/src/extend_css/extra.css @@ -0,0 +1,3 @@ +.extend { + color: red !important; +} diff --git a/tests/rustdoc-gui/src/extend_css/lib.rs b/tests/rustdoc-gui/src/extend_css/lib.rs new file mode 100644 index 00000000000..3a3babf8984 --- /dev/null +++ b/tests/rustdoc-gui/src/extend_css/lib.rs @@ -0,0 +1 @@ +//!
text in red