Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc: simplify CSS selectors on top-doc and non-exhaustive toggles #105320

Merged
merged 1 commit into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ h1, h2, h3, h4, h5, h6,
span.since,
a.srclink,
#help-button > a,
details.rustdoc-toggle.top-doc > summary,
details.rustdoc-toggle.non-exhaustive > summary,
summary.hideme,
.scraped-example-list,
/* This selector is for the items listed in the "all items" page. */
ul.all-items {
Expand Down Expand Up @@ -1484,6 +1483,7 @@ details.rustdoc-toggle {
"Expand description" or "Show methods". */
details.rustdoc-toggle > summary.hideme {
cursor: pointer;
font-size: 1rem;
}

details.rustdoc-toggle > summary {
Expand Down Expand Up @@ -1546,13 +1546,6 @@ details.rustdoc-toggle > summary:focus-visible::before {
outline-offset: 1px;
}

details.rustdoc-toggle.top-doc > summary,
details.rustdoc-toggle.top-doc > summary::before,
details.rustdoc-toggle.non-exhaustive > summary,
details.rustdoc-toggle.non-exhaustive > summary::before {
font-size: 1rem;
}

details.non-exhaustive {
margin-bottom: 8px;
}
Expand Down
5 changes: 5 additions & 0 deletions src/test/rustdoc-gui/enum-variants.goml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ goto: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html"

assert-css: (".variants > .variant", {"margin": "0px 0px 12px"})
assert-css: (".variants > .docblock", {"margin": "0px 0px 32px 24px"})

assert-css: (
"details.non-exhaustive > summary",
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
)
1 change: 1 addition & 0 deletions src/test/rustdoc-gui/src/test_docs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ impl AsRef<str> for Foo {
///
/// # title!
#[doc(alias = "ThisIsAnAlias")]
#[non_exhaustive]
pub enum WhoLetTheDogOut {
/// Woof!
Woof,
Expand Down
4 changes: 4 additions & 0 deletions src/test/rustdoc-gui/toggle-docs.goml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ wait-for: 50
// This is now collapsed so there shouldn't be the "open" attribute on details.
assert-attribute-false: ("#main-content > details.top-doc", {"open": ""})
assert-text: ("#toggle-all-docs", "[+]")
assert-css: (
"#main-content > details.top-doc > summary",
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
)
click: "#toggle-all-docs"
// Not collapsed anymore so the "open" attribute should be back.
wait-for-attribute: ("#main-content > details.top-doc", {"open": ""})
Expand Down