about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2022-12-05 11:15:09 -0700
committerMichael Howell <michael@notriddle.com>2022-12-05 13:01:29 -0700
commit32765fbe101f748ca33d190b0f37b79c23d61241 (patch)
tree3e51179be937c39d4dc6808bcb6617c1f60555e9
parent203c8765ea33c65d888febe0e8219c4bb11b0d89 (diff)
downloadrust-32765fbe101f748ca33d190b0f37b79c23d61241.tar.gz
rust-32765fbe101f748ca33d190b0f37b79c23d61241.zip
rustdoc: simplify CSS selectors on top-doc and non-exhaustive toggles
This code uses a special `hideme` class anyway, so just style that.
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css11
-rw-r--r--src/test/rustdoc-gui/enum-variants.goml5
-rw-r--r--src/test/rustdoc-gui/src/test_docs/lib.rs1
-rw-r--r--src/test/rustdoc-gui/toggle-docs.goml4
4 files changed, 12 insertions, 9 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index f44797fe55f..d9edaf97670 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -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 {
@@ -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 {
@@ -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;
 }
diff --git a/src/test/rustdoc-gui/enum-variants.goml b/src/test/rustdoc-gui/enum-variants.goml
index 230abb236bd..8dfc49285f2 100644
--- a/src/test/rustdoc-gui/enum-variants.goml
+++ b/src/test/rustdoc-gui/enum-variants.goml
@@ -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'},
+)
diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs
index dea154c9319..1340511d472 100644
--- a/src/test/rustdoc-gui/src/test_docs/lib.rs
+++ b/src/test/rustdoc-gui/src/test_docs/lib.rs
@@ -76,6 +76,7 @@ impl AsRef<str> for Foo {
 ///
 /// # title!
 #[doc(alias = "ThisIsAnAlias")]
+#[non_exhaustive]
 pub enum WhoLetTheDogOut {
     /// Woof!
     Woof,
diff --git a/src/test/rustdoc-gui/toggle-docs.goml b/src/test/rustdoc-gui/toggle-docs.goml
index b7d10723767..45bb8daf1f2 100644
--- a/src/test/rustdoc-gui/toggle-docs.goml
+++ b/src/test/rustdoc-gui/toggle-docs.goml
@@ -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": ""})