summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-gui/toggle-docs-mobile.goml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
commita4b7ed7a42c716ab9f05e351f003d589124fd55d (patch)
treeb620cd3f223850b28716e474e80c58059dca5dd4 /tests/rustdoc-gui/toggle-docs-mobile.goml
parentAdding upstream version 1.67.1+dfsg1. (diff)
downloadrustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.tar.xz
rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.zip
Adding upstream version 1.68.2+dfsg1.upstream/1.68.2+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/rustdoc-gui/toggle-docs-mobile.goml')
-rw-r--r--tests/rustdoc-gui/toggle-docs-mobile.goml33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/rustdoc-gui/toggle-docs-mobile.goml b/tests/rustdoc-gui/toggle-docs-mobile.goml
new file mode 100644
index 000000000..6ce24a81b
--- /dev/null
+++ b/tests/rustdoc-gui/toggle-docs-mobile.goml
@@ -0,0 +1,33 @@
+// Checks that the documentation toggles on mobile have the correct position, style and work
+// as expected.
+goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
+size: (433, 600)
+assert-attribute: (".top-doc", {"open": ""})
+click: (4, 270) // This is the position of the top doc comment toggle
+assert-attribute-false: (".top-doc", {"open": ""})
+click: (4, 270)
+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": ""})
+
+// Assert the position of the toggle on the top doc block.
+assert-position: (".top-doc summary::before", {"x": 4})
+// Assert the position of the toggle on the impl block.
+assert-position: ("#implementations-list > details > summary::before", {"x": 4})
+// Assert the position of the toggle on a method.
+assert-position: (
+ "#trait-implementations-list .impl-items .method-toggle > summary::before",
+ {"x": 4},
+)
+
+// Now we do the same but with a little bigger width
+size: (600, 600)
+assert-attribute: (".top-doc", {"open": ""})
+click: (4, 270) // New Y position since all search elements are back on one line.
+assert-attribute-false: (".top-doc", {"open": ""})
+click: (4, 270)
+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": ""})