about summary refs log tree commit diff
path: root/tests/rustdoc-gui
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-03-26 12:05:38 +0000
committerbors <bors@rust-lang.org>2023-03-26 12:05:38 +0000
commit89c2e3d3d75486e52473de3ae38f0ca6efeffef2 (patch)
tree07df5b9bb2675e15c5ecc5e4d55cc379f1cdecd7 /tests/rustdoc-gui
parent2420bd34ba68a625840022de2a56aec228500359 (diff)
parent4aa4ce6ee26045f74f28d6a5067d01bf54221616 (diff)
downloadrust-89c2e3d3d75486e52473de3ae38f0ca6efeffef2.tar.gz
rust-89c2e3d3d75486e52473de3ae38f0ca6efeffef2.zip
Auto merge of #109626 - matthiaskrgr:rollup-k0y7bdd, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #109007 (rustdoc: skip `// some variants omitted` if enum is `#[non_exhaustive]`)
 - #109593 (Rustdoc Book refer to rustdoc::missing_doc_code_examples. Fixes #109592.)
 - #109595 (Improve "Auto-hide trait implementation documentation" GUI test)
 - #109619 (Still-further-specializable projections are ambiguous in new solver)
 - #109620 (Correct typo (`back_box` -> `black_box`))
 - #109621 (Refactor: `VariantIdx::from_u32(0)` -> `FIRST_VARIANT`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests/rustdoc-gui')
-rw-r--r--tests/rustdoc-gui/auto-hide-trait-implementations.goml13
-rw-r--r--tests/rustdoc-gui/setting-auto-hide-trait-implementations.goml47
2 files changed, 47 insertions, 13 deletions
diff --git a/tests/rustdoc-gui/auto-hide-trait-implementations.goml b/tests/rustdoc-gui/auto-hide-trait-implementations.goml
deleted file mode 100644
index 0a619c3524a..00000000000
--- a/tests/rustdoc-gui/auto-hide-trait-implementations.goml
+++ /dev/null
@@ -1,13 +0,0 @@
-// Checks that the setting "auto hide trait implementations" is working as expected.
-goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
-
-// By default, the trait implementations are not collapsed.
-assert-attribute: ("#trait-implementations-list > details", {"open": ""}, ALL)
-
-// We now set the setting to auto hide all trait implementations.
-local-storage: {"rustdoc-auto-hide-trait-implementations": "true" }
-// We reload to ensure the trait implementations are collapsed as expected.
-reload:
-
-// We now check that all matching elements don't have the open attributes.
-assert-attribute-false: ("#trait-implementations-list > details", {"open": ""}, ALL)
diff --git a/tests/rustdoc-gui/setting-auto-hide-trait-implementations.goml b/tests/rustdoc-gui/setting-auto-hide-trait-implementations.goml
new file mode 100644
index 00000000000..7355dddd39d
--- /dev/null
+++ b/tests/rustdoc-gui/setting-auto-hide-trait-implementations.goml
@@ -0,0 +1,47 @@
+// Checks that the setting "auto hide trait implementations" is working as expected.
+
+define-function: (
+    "check-setting",
+    (storage_value, setting_attribute_value, toggle_attribute_value),
+    block {
+        assert-local-storage: {"rustdoc-auto-hide-trait-implementations": |storage_value|}
+        click: "#settings-menu"
+        wait-for: "#settings"
+        assert-property: ("#auto-hide-trait-implementations", {"checked": |setting_attribute_value|})
+        assert-attribute: ("#trait-implementations-list > details", {"open": |toggle_attribute_value|}, ALL)
+    }
+)
+
+goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
+
+// By default, the trait implementations are not collapsed.
+call-function: ("check-setting", {
+    "storage_value": null,
+    "setting_attribute_value": "false",
+    "toggle_attribute_value": "",
+})
+
+// Now we change its value.
+click: "#auto-hide-trait-implementations"
+assert-local-storage: {"rustdoc-auto-hide-trait-implementations": "true"}
+
+// We check that the changes were applied as expected.
+reload:
+
+call-function: ("check-setting", {
+    "storage_value": "true",
+    "setting_attribute_value": "true",
+    "toggle_attribute_value": null,
+})
+
+// And now we re-disable the setting.
+click: "#auto-hide-trait-implementations"
+assert-local-storage: {"rustdoc-auto-hide-trait-implementations": "false"}
+
+// And we check everything is back the way it was before.
+reload:
+call-function: ("check-setting", {
+    "storage_value": "false",
+    "setting_attribute_value": "false",
+    "toggle_attribute_value": "",
+})