about summary refs log tree commit diff
path: root/tests/rustdoc-gui/toggle-docs-mobile.goml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rustdoc-gui/toggle-docs-mobile.goml')
-rw-r--r--tests/rustdoc-gui/toggle-docs-mobile.goml26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/rustdoc-gui/toggle-docs-mobile.goml b/tests/rustdoc-gui/toggle-docs-mobile.goml
index be12e4c19b3..6a40ba83b84 100644
--- a/tests/rustdoc-gui/toggle-docs-mobile.goml
+++ b/tests/rustdoc-gui/toggle-docs-mobile.goml
@@ -31,3 +31,29 @@ assert-attribute: (".top-doc", {"open": ""})
 // To ensure that the toggle isn't over the text, we check that the toggle isn't clicked.
 click: (3, 270)
 assert-attribute: (".top-doc", {"open": ""})
+
+// Same check on trait items.
+fail-on-request-error: false // To prevent downloads errors on "trait.impl/test_docs/trait.ItemsTrait.js"
+go-to: "file://" + |DOC_PATH| + "/test_docs/trait.ItemsTrait.html"
+
+define-function: (
+    "check-trait-item",
+    [nth, text],
+    block {
+        store-value: (selector, ".methods:nth-of-type(" + |nth| + ") > details summary")
+        assert-text: (|selector| + " h4", |text|)
+        assert-position: (
+            |selector| + "::before",
+            {"x": 6},
+        )
+    },
+)
+
+// Assert the position of the toggle on an associated const.
+call-function: ("check-trait-item", {"nth": 2, "text": "const X: u32"})
+// Assert the position of the toggle on an associated type.
+call-function: ("check-trait-item", {"nth": 3, "text": "type F"})
+// Assert the position of the toggle on an associated required method.
+call-function: ("check-trait-item", {"nth": 4, "text": "fn bar()"})
+// Assert the position of the toggle on an associated provided method.
+call-function: ("check-trait-item", {"nth": 5, "text": "fn foo()"})