Skip to content

Commit 3734a75

Browse files
gui test
1 parent 96d3414 commit 3734a75

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Checks that individual trait impls can only be collapsed via clicking directly on the summary element
2+
include: "utils.goml"
3+
4+
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
5+
assert-attribute: ("details:has(#trait-impl-link-in-summary)", {"open": ""})
6+
7+
// Collapse the trait impl doc. The actual clickable area is outside the element, hence offset.
8+
click-with-offset: ("summary:has(#trait-impl-link-in-summary)", {"x": -15, "y": 5})
9+
assert-attribute-false: ("details:has(#trait-impl-link-in-summary)", {"open": ""})
10+
11+
// Clicks on the text should be ignored
12+
click: "summary:has(#trait-impl-link-in-summary) > .impl"
13+
assert-window-property: ({"pageYOffset": "0"})
14+
15+
// But links should still work
16+
click: "#trait-impl-link-in-summary"
17+
assert-window-property-false: ({"pageYOffset": "0"})
18+
19+
// As well as clicks on elements within links
20+
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
21+
assert-window-property: ({"pageYOffset": "0"})
22+
click: "#trait-impl-link-in-summary"
23+
assert-window-property-false: ({"pageYOffset": "0"})

tests/rustdoc-gui/src/test_docs/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ impl Foo {
7979
pub fn warning2() {}
8080
}
8181

82+
/// <a href="#implementations"><code id="trait-impl-link-in-summary">A collapsible trait impl with a link</code></a>
8283
impl AsRef<str> for Foo {
8384
fn as_ref(&self) -> &str {
8485
"hello"

0 commit comments

Comments
 (0)