Skip to content

Commit b8db8cc

Browse files
Add GUI test for <details>/<summary> display
1 parent 07596fe commit b8db8cc

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// This ensures that the `<details>`/`<summary>` elements are displayed as expected.
2+
goto: file://|DOC_PATH|/test_docs/details/struct.Details.html
3+
show-text: true
4+
local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
5+
reload:
6+
7+
// We first check that the headers in the `.top-doc` doc block still have their
8+
// bottom border.
9+
assert-text: (".top-doc .docblock > h3", "Hello")
10+
assert-css: (
11+
".top-doc .docblock > h3",
12+
{"border-bottom": "1px solid rgb(221, 221, 221)"},
13+
)
14+
// We now check that the `<summary>` doesn't have a bottom border and has the correct display.
15+
assert-css: (
16+
".top-doc .docblock summary h4",
17+
{"border-bottom": "0px none rgb(221, 221, 221)"},
18+
)
19+
// This allows to ensure that summary is on one line only!
20+
assert-property: (".top-doc .docblock summary h4", {"offsetHeight": "33"})
21+
assert-css: (".top-doc .docblock summary h4", {"margin-top": "15px", "margin-bottom": "5px"})
22+
// So `33 + 15 + 5` == `53`
23+
assert-property: (".top-doc .docblock summary", {"offsetHeight": "53"})

src/test/rustdoc-gui/src/test_docs/lib.rs

+12
Original file line numberDiff line numberDiff line change
@@ -277,3 +277,15 @@ pub use macros::*;
277277

278278
#[doc(alias = "AliasForTheStdReexport")]
279279
pub use ::std as TheStdReexport;
280+
281+
pub mod details {
282+
/// We check the appearance of the `<details>`/`<summary>` in here.
283+
///
284+
/// ## Hello
285+
///
286+
/// <details>
287+
/// <summary><h4>I'm a summary</h4></summary>
288+
/// <div>I'm the content of the details!</div>
289+
/// </details>
290+
pub struct Details;
291+
}

0 commit comments

Comments
 (0)