about summary refs log tree commit diff
path: root/tests/rustdoc-gui/code-example-buttons.goml
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2024-09-01 23:43:27 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2024-09-01 23:43:27 +0200
commit5a8563262342d89da0899b2fda4436cb6f367660 (patch)
treeee34cb9e839324dc084ad21dca9fc04b311633be /tests/rustdoc-gui/code-example-buttons.goml
parent4825fb198f9abb58ddc877d9bbf49c8834a68a68 (diff)
downloadrust-5a8563262342d89da0899b2fda4436cb6f367660.tar.gz
rust-5a8563262342d89da0899b2fda4436cb6f367660.zip
Correctly handle code examples buttons position
Diffstat (limited to 'tests/rustdoc-gui/code-example-buttons.goml')
-rw-r--r--tests/rustdoc-gui/code-example-buttons.goml21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/rustdoc-gui/code-example-buttons.goml b/tests/rustdoc-gui/code-example-buttons.goml
index 4f037ec79f5..a6c8a862d1a 100644
--- a/tests/rustdoc-gui/code-example-buttons.goml
+++ b/tests/rustdoc-gui/code-example-buttons.goml
@@ -94,3 +94,24 @@ call-function: ("check-buttons",{
     "filter": "invert(0.5)",
     "filter_hover": "invert(0.35)",
 })
+
+define-function: (
+    "check-buttons-position",
+    [pre_selector],
+    block {
+        move-cursor-to: |pre_selector| + " .rust:not(.item-decl)"
+        store-position: (|pre_selector| + " .rust:not(.item-decl)", {"x": x, "y": y})
+        assert-position: (|pre_selector| + " .rust:not(.item-decl) + .button-holder", {
+            "y": |y| + 4,
+        })
+    }
+)
+
+call-function: ("check-buttons-position", {"pre_selector": ".example-wrap"})
+
+go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
+// We should work as well for scraped examples.
+call-function: ("check-buttons-position", {"pre_selector": ".example-wrap.scraped-example"})
+// And also when the scraped example "title" goes above.
+set-window-size: (600, 600)
+call-function: ("check-buttons-position", {"pre_selector": ".example-wrap.scraped-example"})