Add GUI test for clicking on non-toggle summary

This commit is contained in:
Jacob Hoffman-Andrews 2021-11-22 00:49:57 -08:00
parent 9aef9a2324
commit 7f35556a25
3 changed files with 11 additions and 1 deletions

View File

@ -891,7 +891,7 @@ function hideThemeButtonState() {
if (e.target.tagName != "SUMMARY") {
e.preventDefault();
}
})
});
});
onEachLazy(document.getElementsByClassName("notable-traits"), function(e) {

View File

@ -22,6 +22,8 @@ pub struct Foo {
}
impl Foo {
/// Some documentation
/// # A Heading
pub fn a_method(&self) {}
}

View File

@ -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": ""})