Skip to content

Commit efad057

Browse files
Add tests to check that collapsed content is expanded when jumping to it
1 parent aab9e32 commit efad057

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
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)