File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 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"})
Original file line number Diff line number Diff 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>
8283impl AsRef < str > for Foo {
8384 fn as_ref ( & self ) -> & str {
8485 "hello"
You can’t perform that action at this time.
0 commit comments