Skip to content

Commit 7f35556

Browse files
committed
Add GUI test for clicking on non-toggle summary
1 parent 9aef9a2 commit 7f35556

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/librustdoc/html/static/js/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ function hideThemeButtonState() {
891891
if (e.target.tagName != "SUMMARY") {
892892
e.preventDefault();
893893
}
894-
})
894+
});
895895
});
896896

897897
onEachLazy(document.getElementsByClassName("notable-traits"), function(e) {

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

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ pub struct Foo {
2222
}
2323

2424
impl Foo {
25+
/// Some documentation
26+
/// # A Heading
2527
pub fn a_method(&self) {}
2628
}
2729

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This test ensures that clicking on a method summary, but not on the "[-]",
2+
// doesn't toggle the <details>.
3+
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
4+
assert-attribute: (".impl-items .rustdoc-toggle", {"open": ""})
5+
click: "h4.code-header" // This is the position of "pub" in "pub fn a_method"
6+
assert-attribute: (".impl-items .rustdoc-toggle", {"open": ""})
7+
click: ".impl-items .rustdoc-toggle summary::before" // This is the position of "[-]" next to that pub fn.
8+
assert-attribute-false: (".impl-items .rustdoc-toggle", {"open": ""})

0 commit comments

Comments
 (0)