Rollup merge of #105320 - notriddle:notriddle/rustdoc-toggle-hideme-2, r=GuillaumeGomez

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

This code uses a special `hideme` class anyway, so just style that.
This commit is contained in:
Matthias Krüger 2022-12-06 16:54:55 +01:00 committed by GitHub
commit dc07e1bbdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 9 deletions

View File

@ -195,8 +195,7 @@ h1, h2, h3, h4, h5, h6,
span.since, span.since,
a.srclink, a.srclink,
#help-button > a, #help-button > a,
details.rustdoc-toggle.top-doc > summary, summary.hideme,
details.rustdoc-toggle.non-exhaustive > summary,
.scraped-example-list, .scraped-example-list,
/* This selector is for the items listed in the "all items" page. */ /* This selector is for the items listed in the "all items" page. */
ul.all-items { ul.all-items {
@ -1484,6 +1483,7 @@ details.rustdoc-toggle {
"Expand description" or "Show methods". */ "Expand description" or "Show methods". */
details.rustdoc-toggle > summary.hideme { details.rustdoc-toggle > summary.hideme {
cursor: pointer; cursor: pointer;
font-size: 1rem;
} }
details.rustdoc-toggle > summary { details.rustdoc-toggle > summary {
@ -1546,13 +1546,6 @@ details.rustdoc-toggle > summary:focus-visible::before {
outline-offset: 1px; 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 { details.non-exhaustive {
margin-bottom: 8px; margin-bottom: 8px;
} }

View File

@ -3,3 +3,8 @@ goto: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html"
assert-css: (".variants > .variant", {"margin": "0px 0px 12px"}) assert-css: (".variants > .variant", {"margin": "0px 0px 12px"})
assert-css: (".variants > .docblock", {"margin": "0px 0px 32px 24px"}) assert-css: (".variants > .docblock", {"margin": "0px 0px 32px 24px"})
assert-css: (
"details.non-exhaustive > summary",
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
)

View File

@ -76,6 +76,7 @@ impl AsRef<str> for Foo {
/// ///
/// # title! /// # title!
#[doc(alias = "ThisIsAnAlias")] #[doc(alias = "ThisIsAnAlias")]
#[non_exhaustive]
pub enum WhoLetTheDogOut { pub enum WhoLetTheDogOut {
/// Woof! /// Woof!
Woof, Woof,

View File

@ -7,6 +7,10 @@ wait-for: 50
// This is now collapsed so there shouldn't be the "open" attribute on details. // This is now collapsed so there shouldn't be the "open" attribute on details.
assert-attribute-false: ("#main-content > details.top-doc", {"open": ""}) assert-attribute-false: ("#main-content > details.top-doc", {"open": ""})
assert-text: ("#toggle-all-docs", "[+]") 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" click: "#toggle-all-docs"
// Not collapsed anymore so the "open" attribute should be back. // Not collapsed anymore so the "open" attribute should be back.
wait-for-attribute: ("#main-content > details.top-doc", {"open": ""}) wait-for-attribute: ("#main-content > details.top-doc", {"open": ""})