11// Check that the line number column has the correct layout.
22go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
33
4+ set-window-size: (1000, 1000)
5+
46// Check that it's not zero.
57assert-property-false: (
68 ".more-scraped-examples .scraped-example .src-line-numbers",
@@ -33,6 +35,18 @@ assert-property: (
3335 {"clientWidth": |clientWidth|}
3436)
3537
38+ // The "title" should be located at the right bottom corner of the code example.
39+ store-position: (".example-wrap.scraped-example", {"x": x, "y": y})
40+ store-size: (".example-wrap.scraped-example", {"width": width, "height": height})
41+ store-size: (".example-wrap.scraped-example .scraped-example-title", {
42+ "width": title_width,
43+ "height": title_height,
44+ })
45+ assert-position: (".example-wrap.scraped-example .scraped-example-title", {
46+ "x": |x| + |width| - |title_width| - 5,
47+ "y": |y| + |height| - |title_height| - 8,
48+ })
49+
3650// Check that for both mobile and desktop sizes, the buttons in scraped examples are displayed
3751// correctly.
3852
@@ -46,3 +60,32 @@ assert-position: (".scraped-example .prev", {"y": 226 + |offset_y|})
4660set-window-size: (600, 600)
4761assert-position: (".scraped-example", {"y": 284})
4862assert-position: (".scraped-example .prev", {"y": 284 + |offset_y|})
63+
64+ define-function: (
65+ "check_title_and_code_position",
66+ [],
67+ block {
68+ // Title should be above the code.
69+ store-position: (".example-wrap.scraped-example .src-line-numbers", {"x": x, "y": y})
70+ store-size: (".example-wrap.scraped-example .scraped-example-title", { "height": title_height })
71+
72+ assert-position: (".example-wrap.scraped-example .scraped-example-title", {
73+ "x": |x|, // same X position.
74+ "y": |y| - |title_height|,
75+ })
76+
77+ // Line numbers should be right beside the code.
78+ compare-elements-position: (
79+ ".example-wrap.scraped-example .src-line-numbers",
80+ ".example-wrap.scraped-example .rust",
81+ ["y"],
82+ )
83+ }
84+ )
85+
86+ // Check that the title is now above the code.
87+ call-function: ("check_title_and_code_position", {})
88+
89+ // Then with small mobile
90+ set-window-size: (300, 300)
91+ call-function: ("check_title_and_code_position", {})
0 commit comments