Add/update tests for --extend-css
option
This commit is contained in:
parent
bf6582e0cc
commit
6bc6ea7a3e
@ -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);
|
||||
}
|
||||
|
5
tests/rustdoc-gui/extend-css.goml
Normal file
5
tests/rustdoc-gui/extend-css.goml
Normal file
@ -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)"})
|
@ -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"
|
||||
|
@ -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)
|
||||
|
@ -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"})
|
||||
|
7
tests/rustdoc-gui/src/extend_css/Cargo.lock
Normal file
7
tests/rustdoc-gui/src/extend_css/Cargo.lock
Normal file
@ -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"
|
7
tests/rustdoc-gui/src/extend_css/Cargo.toml
Normal file
7
tests/rustdoc-gui/src/extend_css/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "extend_css"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
3
tests/rustdoc-gui/src/extend_css/extra.css
Normal file
3
tests/rustdoc-gui/src/extend_css/extra.css
Normal file
@ -0,0 +1,3 @@
|
||||
.extend {
|
||||
color: red !important;
|
||||
}
|
1
tests/rustdoc-gui/src/extend_css/lib.rs
Normal file
1
tests/rustdoc-gui/src/extend_css/lib.rs
Normal file
@ -0,0 +1 @@
|
||||
//! <div class="extend">text in red</div>
|
Loading…
Reference in New Issue
Block a user