Skip to content

Commit

Permalink
Add test to ensure that the element pointed to by the URL hash is "ex…
Browse files Browse the repository at this point in the history
…panded"
  • Loading branch information
GuillaumeGomez committed Apr 25, 2021
1 parent 1afea79 commit 9b44c4b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/test/rustdoc-gui/hash-item-expansion.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// This test ensures that the element corresponding to the hash is displayed.
goto: file://|DOC_PATH|/struct.Foo.html#method.borrow
// In the blanket implementations list, "Borrow" is the second one, hence the ":nth(2)".
assert: ("#blanket-implementations-list > details:nth-child(2)", "open", "")
// Please note the "\" below is needed because otherwise ".borrow" would be interpreted as
// a class selector.
assert: ("#method\.borrow", {"display": "flex"})
// We first check that the impl block is open by default.
assert: ("#implementations + details", "open", "")
// We collapse it.
click: "#implementations + details > summary"
// We check that it was collapsed as expected.
assert-false: ("#implementations + details", "open", "")
// To ensure that we will click on the currently hidden method.
assert: (".sidebar-links > a", "must_use")
click: ".sidebar-links > a"
// We check that the impl block was opened as expected so that we can see the method.
assert: ("#implementations + details", "open", "")

0 comments on commit 9b44c4b

Please sign in to comment.