Skip to content

Commit

Permalink
Add GUI test for clicking on non-toggle summary
Browse files Browse the repository at this point in the history
  • Loading branch information
jsha committed Nov 22, 2021
1 parent 9aef9a2 commit 7f35556
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ function hideThemeButtonState() {
if (e.target.tagName != "SUMMARY") {
e.preventDefault();
}
})
});
});

onEachLazy(document.getElementsByClassName("notable-traits"), function(e) {
Expand Down
2 changes: 2 additions & 0 deletions src/test/rustdoc-gui/src/lib2/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ pub struct Foo {
}

impl Foo {
/// Some documentation
/// # A Heading
pub fn a_method(&self) {}
}

Expand Down
8 changes: 8 additions & 0 deletions src/test/rustdoc-gui/toggle-click-deadspace.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This test ensures that clicking on a method summary, but not on the "[-]",
// doesn't toggle the <details>.
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
assert-attribute: (".impl-items .rustdoc-toggle", {"open": ""})
click: "h4.code-header" // This is the position of "pub" in "pub fn a_method"
assert-attribute: (".impl-items .rustdoc-toggle", {"open": ""})
click: ".impl-items .rustdoc-toggle summary::before" // This is the position of "[-]" next to that pub fn.
assert-attribute-false: (".impl-items .rustdoc-toggle", {"open": ""})

0 comments on commit 7f35556

Please sign in to comment.