about summary refs log tree commit diff
path: root/tests/rustdoc-gui/scrape-examples-layout.goml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rustdoc-gui/scrape-examples-layout.goml')
-rw-r--r--tests/rustdoc-gui/scrape-examples-layout.goml47
1 files changed, 17 insertions, 30 deletions
diff --git a/tests/rustdoc-gui/scrape-examples-layout.goml b/tests/rustdoc-gui/scrape-examples-layout.goml
index 5187ac486b0..85a3b2a6287 100644
--- a/tests/rustdoc-gui/scrape-examples-layout.goml
+++ b/tests/rustdoc-gui/scrape-examples-layout.goml
@@ -3,35 +3,38 @@ go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
 
 set-window-size: (1000, 1000)
 
+// We move the mouse over the scraped example for the prev button to be generated.
+move-cursor-to: ".scraped-example"
+
 // Check that it's not zero.
 assert-property-false: (
-    ".more-scraped-examples .scraped-example .src-line-numbers",
+    ".more-scraped-examples .scraped-example span[data-nosnippet]",
     {"clientWidth": "0"}
 )
 
 // Check that examples with very long lines have the same width as ones that don't.
 store-property: (
-    ".more-scraped-examples .scraped-example:nth-child(2) .src-line-numbers",
+    ".more-scraped-examples .scraped-example:nth-child(2) span[data-nosnippet]",
     {"clientWidth": clientWidth},
 )
 
 assert-property: (
-    ".more-scraped-examples .scraped-example:nth-child(3) .src-line-numbers",
+    ".more-scraped-examples .scraped-example:nth-child(3) span[data-nosnippet]",
     {"clientWidth": |clientWidth|}
 )
 
 assert-property: (
-    ".more-scraped-examples .scraped-example:nth-child(4) .src-line-numbers",
+    ".more-scraped-examples .scraped-example:nth-child(4) span[data-nosnippet]",
     {"clientWidth": |clientWidth|}
 )
 
 assert-property: (
-    ".more-scraped-examples .scraped-example:nth-child(5) .src-line-numbers",
+    ".more-scraped-examples .scraped-example:nth-child(5) span[data-nosnippet]",
     {"clientWidth": |clientWidth|}
 )
 
 assert-property: (
-    ".more-scraped-examples .scraped-example:nth-child(6) .src-line-numbers",
+    ".more-scraped-examples .scraped-example:nth-child(6) span[data-nosnippet]",
     {"clientWidth": |clientWidth|}
 )
 
@@ -55,25 +58,6 @@ assert-size: (".more-scraped-examples .scraped-example .example-wrap", {
     "width": |width|,
 })
 
-// Check that the expand button works and also that line number aligns with code.
-move-cursor-to: ".scraped-example .rust"
-click: ".scraped-example .button-holder .expand"
-wait-for: ".scraped-example.expanded"
-// They should have the same y position.
-compare-elements-position: (
-    ".scraped-example.expanded .src-line-numbers pre span",
-    ".scraped-example.expanded .rust code",
-    ["y"],
-)
-// And they should have the same height.
-compare-elements-size: (
-    ".scraped-example.expanded .src-line-numbers",
-    ".scraped-example.expanded .rust",
-    ["height"],
-)
-// Collapse code again.
-click: ".scraped-example .button-holder .expand"
-
 // Check that for both mobile and desktop sizes, the buttons in scraped examples are displayed
 // correctly.
 
@@ -98,7 +82,7 @@ define-function: (
     [],
     block {
         // Title should be above the code.
-        store-position: (".scraped-example .example-wrap .src-line-numbers", {"x": x, "y": y})
+        store-position: (".scraped-example .example-wrap", {"x": x, "y": y})
         store-size: (".scraped-example .scraped-example-title", { "height": title_height })
 
         assert-position: (".scraped-example .scraped-example-title", {
@@ -107,10 +91,13 @@ define-function: (
         })
 
         // Line numbers should be right beside the code.
-        compare-elements-position: (
-            ".scraped-example .example-wrap .src-line-numbers",
-            ".scraped-example .example-wrap .rust",
-            ["y"],
+        compare-elements-position-near: (
+            ".scraped-example .example-wrap span[data-nosnippet]",
+            // On the first line, the code starts with `fn main` so we have a keyword.
+            ".scraped-example .example-wrap .rust span.kw",
+            // They're not exactly the same size but since they're on the same line,
+            // it's kinda the same.
+            {"y": 2},
         )
     }
 )