about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2021-04-25 16:06:42 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2021-04-25 16:06:42 +0200
commit9b44c4b29c79edf92a9974d2d72a01c7832e273d (patch)
tree39238917c0d1ab4b08dc258d61e55f07a3cf29a2
parent1afea79e42f1090d0c565be16442a95f899c6c60 (diff)
downloadrust-9b44c4b29c79edf92a9974d2d72a01c7832e273d.tar.gz
rust-9b44c4b29c79edf92a9974d2d72a01c7832e273d.zip
Add test to ensure that the element pointed to by the URL hash is "expanded"
-rw-r--r--src/test/rustdoc-gui/hash-item-expansion.goml18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/rustdoc-gui/hash-item-expansion.goml b/src/test/rustdoc-gui/hash-item-expansion.goml
new file mode 100644
index 00000000000..d736d15d184
--- /dev/null
+++ b/src/test/rustdoc-gui/hash-item-expansion.goml
@@ -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", "")