about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2022-02-19 14:46:37 +0100
committerGuillaume Gomez <guillaume.gomez@huawei.com>2022-02-25 11:11:52 +0100
commitec50cdbe10e6aa5f82820684d79bceef68f56f6c (patch)
tree5f30c1f49c223d9cee8e9788b57c6fe32d0a6534
parentb8967b0d52a2ba5f0c9da0da03e78ccba5534e4a (diff)
downloadrust-ec50cdbe10e6aa5f82820684d79bceef68f56f6c.tar.gz
rust-ec50cdbe10e6aa5f82820684d79bceef68f56f6c.zip
Extend toggle GUI test a bit
-rw-r--r--src/test/rustdoc-gui/toggle-docs.goml28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/test/rustdoc-gui/toggle-docs.goml b/src/test/rustdoc-gui/toggle-docs.goml
index 480d6242ac6..477105193d3 100644
--- a/src/test/rustdoc-gui/toggle-docs.goml
+++ b/src/test/rustdoc-gui/toggle-docs.goml
@@ -3,12 +3,36 @@ goto: file://|DOC_PATH|/test_docs/index.html
 assert-attribute: ("#main-content > details.top-doc", {"open": ""})
 assert-text: ("#toggle-all-docs", "[−]")
 click: "#toggle-all-docs"
-wait-for: 1000
+wait-for: 50
 // This is now collapsed so there shouldn't be the "open" attribute on details.
 assert-attribute-false: ("#main-content > details.top-doc", {"open": ""})
 assert-text: ("#toggle-all-docs", "[+]")
 click: "#toggle-all-docs"
-wait-for: 1000
+wait-for: 50
 // Not collapsed anymore so the "open" attribute should be back.
 assert-attribute: ("#main-content > details.top-doc", {"open": ""})
 assert-text: ("#toggle-all-docs", "[−]")
+
+// Check that it works on non-module pages as well.
+goto: file://|DOC_PATH|/test_docs/struct.Foo.html
+// We first check that everything is visible.
+assert-text: ("#toggle-all-docs", "[−]")
+assert-attribute: ("details.rustdoc-toggle", {"open": ""}, ALL)
+// We collapse them all.
+click: "#toggle-all-docs"
+wait-for: 50
+assert-text: ("#toggle-all-docs", "[+]")
+// We check that all <details> are collapsed (except for the impl block ones).
+assert-attribute-false: ("details.rustdoc-toggle:not(.implementors-toggle)", {"open": ""}, ALL)
+assert-attribute: ("details.rustdoc-toggle.implementors-toggle", {"open": ""})
+// We now check that the other impl blocks are collapsed.
+assert-attribute-false: (
+    "#blanket-implementations-list > details.rustdoc-toggle.implementors-toggle",
+    {"open": ""},
+    ALL,
+)
+// We open them all again.
+click: "#toggle-all-docs"
+wait-for: 50
+assert-text: ("#toggle-all-docs", "[−]")
+assert-attribute: ("details.rustdoc-toggle", {"open": ""}, ALL)