File tree Expand file tree Collapse file tree 5 files changed +27
-9
lines changed Expand file tree Collapse file tree 5 files changed +27
-9
lines changed Original file line number Diff line number Diff line change @@ -1305,7 +1305,7 @@ fn render_impl(
13051305 if let Some ( use_absolute) = use_absolute {
13061306 write ! (
13071307 w,
1308- "<details class=\" rustdoc-toggle implementors-toggle\" >\
1308+ "<details class=\" rustdoc-toggle implementors-toggle\" open >\
13091309 <summary>\
13101310 <h3 id=\" {}\" class=\" impl\" {}>\
13111311 <code class=\" in-band\" >",
@@ -1334,7 +1334,7 @@ fn render_impl(
13341334 } else {
13351335 write ! (
13361336 w,
1337- "<details class=\" rustdoc-toggle implementors-toggle\" >\
1337+ "<details class=\" rustdoc-toggle implementors-toggle\" open >\
13381338 <summary>\
13391339 <h3 id=\" {}\" class=\" impl\" {}>\
13401340 <code class=\" in-band\" >{}</code>",
Original file line number Diff line number Diff line change @@ -480,6 +480,8 @@ function hideThemeButtonState() {
480480 }
481481 // Open all ancestor <details> to make this element visible.
482482 openParentDetails ( h3 . parentNode ) ;
483+ } else {
484+ openParentDetails ( elem . parentNode ) ;
483485 }
484486 }
485487 }
@@ -1412,9 +1414,9 @@ function hideThemeButtonState() {
14121414 // errors in mobile browsers).
14131415 if ( e . tagName === "H2" || e . tagName === "H3" ) {
14141416 var nextTagName = e . nextElementSibling . tagName ;
1415- if ( nextTagName == "H2" || nextTagName == "H3" ) {
1417+ if ( nextTagName === "H2" || nextTagName = == "H3" ) {
14161418 e . nextElementSibling . style . display = "flex" ;
1417- } else {
1419+ } else if ( nextTagName !== "DETAILS" ) {
14181420 e . nextElementSibling . style . display = "block" ;
14191421 }
14201422 }
Original file line number Diff line number Diff line change 1+ // This test ensures that the element corresponding to the hash is displayed.
2+ goto: file://|DOC_PATH|/struct.Foo.html#method.borrow
3+ // In the blanket implementations list, "Borrow" is the second one, hence the ":nth(2)".
4+ assert: ("#blanket-implementations-list > details:nth-child(2)", "open", "")
5+ // Please note the "\" below is needed because otherwise ".borrow" would be interpreted as
6+ // a class selector.
7+ assert: ("#method\.borrow", {"display": "flex"})
8+ // We first check that the impl block is open by default.
9+ assert: ("#implementations + details", "open", "")
10+ // We collapse it.
11+ click: "#implementations + details > summary"
12+ // We check that it was collapsed as expected.
13+ assert-false: ("#implementations + details", "open", "")
14+ // To ensure that we will click on the currently hidden method.
15+ assert: (".sidebar-links > a", "must_use")
16+ click: ".sidebar-links > a"
17+ // We check that the impl block was opened as expected so that we can see the method.
18+ assert: ("#implementations + details", "open", "")
Original file line number Diff line number Diff line change 1+ // This test ensures that the impl blocks are open by default.
2+ goto: file://|DOC_PATH|/struct.Foo.html
3+ assert: ("#main > details.implementors-toggle", "open", "")
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments