2023-03-31 14:51:50 +00:00
|
|
|
// This test ensures that when clicking on a link which leads to an item inside a collapsed element,
|
|
|
|
// the collapsed element will be expanded.
|
2023-04-11 17:11:34 +00:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
|
2023-03-31 14:51:50 +00:00
|
|
|
// We check that the implementors block is expanded.
|
|
|
|
assert-property: ("#implementations-list .implementors-toggle", {"open": "true"})
|
|
|
|
// We now collapse the implementors block.
|
2023-04-11 17:11:34 +00:00
|
|
|
set-property: ("#implementations-list .implementors-toggle", {"open": "false"})
|
2023-03-31 14:51:50 +00:00
|
|
|
// And now we click on the link to the method to ensure it'll expand the implementors block.
|
|
|
|
click: "//*[@class='sidebar']//a[@href='#method.must_use']"
|
|
|
|
assert-property: ("#implementations-list .implementors-toggle", {"open": "true"})
|
|
|
|
|
2023-04-06 18:26:27 +00:00
|
|
|
define-function: ("collapsed-from-search", (), block {
|
|
|
|
// Now we do the same through search result.
|
|
|
|
// First we reload the page without the anchor in the URL.
|
2023-04-11 17:11:34 +00:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
|
2023-04-06 18:26:27 +00:00
|
|
|
// Then we collapse the section again...
|
2023-04-11 17:11:34 +00:00
|
|
|
set-property: ("#implementations-list .implementors-toggle", {"open": "false"})
|
2023-04-06 18:26:27 +00:00
|
|
|
// Then we run the search.
|
|
|
|
write: (".search-input", "foo::must_use")
|
|
|
|
wait-for: "//*[@id='search']//a[@href='../test_docs/struct.Foo.html#method.must_use']"
|
|
|
|
click: "//*[@id='search']//a[@href='../test_docs/struct.Foo.html#method.must_use']"
|
|
|
|
assert-property: ("#implementations-list .implementors-toggle", {"open": "true"})
|
|
|
|
})
|
|
|
|
|
|
|
|
call-function: ("collapsed-from-search", {})
|
|
|
|
|
|
|
|
// Now running the same check but with mobile.
|
2023-04-11 17:11:34 +00:00
|
|
|
set-window-size: (600, 600)
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
|
2023-04-06 18:26:27 +00:00
|
|
|
// We check that the implementors block is expanded.
|
|
|
|
assert-property: ("#implementations-list .implementors-toggle", {"open": "true"})
|
|
|
|
// We now collapse the implementors block.
|
2023-04-11 17:11:34 +00:00
|
|
|
set-property: ("#implementations-list .implementors-toggle", {"open": "false"})
|
2023-04-06 18:26:27 +00:00
|
|
|
// First we expand the mobile menu.
|
|
|
|
click: ".sidebar-menu-toggle"
|
|
|
|
// Then we click on the link to the method to ensure it'll expand the implementors block.
|
|
|
|
click: "//*[@class='sidebar shown']//a[@href='#method.must_use']"
|
2023-03-31 14:51:50 +00:00
|
|
|
assert-property: ("#implementations-list .implementors-toggle", {"open": "true"})
|
2023-04-06 18:26:27 +00:00
|
|
|
|
|
|
|
call-function: ("collapsed-from-search", {})
|