Skip to content

Commit 32842e8

Browse files
Rollup merge of #109818 - GuillaumeGomez:test-collapsed-item, r=notriddle
rustdoc: Add GUI test for jump to collapsed item Part of #66181. I updated `browser-ui-test` version because I needed to add a new command `property`: GuillaumeGomez/browser-UI-test#452. r? `@notriddle`
2 parents d732934 + efad057 commit 32842e8

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.14.5
1+
0.14.6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// This test ensures that when clicking on a link which leads to an item inside a collapsed element,
2+
// the collapsed element will be expanded.
3+
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
4+
// We check that the implementors block is expanded.
5+
assert-property: ("#implementations-list .implementors-toggle", {"open": "true"})
6+
// We now collapse the implementors block.
7+
property: ("#implementations-list .implementors-toggle", {"open": "false"})
8+
// And now we click on the link to the method to ensure it'll expand the implementors block.
9+
click: "//*[@class='sidebar']//a[@href='#method.must_use']"
10+
assert-property: ("#implementations-list .implementors-toggle", {"open": "true"})
11+
12+
// Now we do the same through search result.
13+
// First we reload the page without the anchor in the URL.
14+
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
15+
// Then we collapse the section again...
16+
property: ("#implementations-list .implementors-toggle", {"open": "false"})
17+
// Then we run the search.
18+
write: (".search-input", "foo::must_use")
19+
wait-for: "//*[@id='search']//a[@href='../test_docs/struct.Foo.html#method.must_use']"
20+
click: "//*[@id='search']//a[@href='../test_docs/struct.Foo.html#method.must_use']"
21+
assert-property: ("#implementations-list .implementors-toggle", {"open": "true"})

0 commit comments

Comments
 (0)