diff options
| author | Jacob Hoffman-Andrews <github@hoffman-andrews.com> | 2021-11-22 00:49:57 -0800 |
|---|---|---|
| committer | Jacob Hoffman-Andrews <github@hoffman-andrews.com> | 2021-11-22 01:17:20 -0800 |
| commit | 7f35556a256241579f6f1b0905fd671bc1182af1 (patch) | |
| tree | cbbeff48e163f4d1614df9bae110e61772158290 | |
| parent | 9aef9a2324fc1a1951e470c645df6c1b11a5ffdc (diff) | |
| download | rust-7f35556a256241579f6f1b0905fd671bc1182af1.tar.gz rust-7f35556a256241579f6f1b0905fd671bc1182af1.zip | |
Add GUI test for clicking on non-toggle summary
| -rw-r--r-- | src/librustdoc/html/static/js/main.js | 2 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/src/lib2/lib.rs | 2 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/toggle-click-deadspace.goml | 8 |
3 files changed, 11 insertions, 1 deletions
diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index 908d3f65fd3..32aa82195a9 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -891,7 +891,7 @@ function hideThemeButtonState() { if (e.target.tagName != "SUMMARY") { e.preventDefault(); } - }) + }); }); onEachLazy(document.getElementsByClassName("notable-traits"), function(e) { diff --git a/src/test/rustdoc-gui/src/lib2/lib.rs b/src/test/rustdoc-gui/src/lib2/lib.rs index f2e76b546c4..79354ec8745 100644 --- a/src/test/rustdoc-gui/src/lib2/lib.rs +++ b/src/test/rustdoc-gui/src/lib2/lib.rs @@ -22,6 +22,8 @@ pub struct Foo { } impl Foo { + /// Some documentation + /// # A Heading pub fn a_method(&self) {} } diff --git a/src/test/rustdoc-gui/toggle-click-deadspace.goml b/src/test/rustdoc-gui/toggle-click-deadspace.goml new file mode 100644 index 00000000000..4d08927a7be --- /dev/null +++ b/src/test/rustdoc-gui/toggle-click-deadspace.goml @@ -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": ""}) |
