1
1
// Check that the line number column has the correct layout.
2
2
go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
3
3
4
+ set-window-size: (1000, 1000)
5
+
4
6
// Check that it's not zero.
5
7
assert-property-false: (
6
8
".more-scraped-examples .scraped-example .src-line-numbers",
@@ -33,6 +35,18 @@ assert-property: (
33
35
{"clientWidth": |clientWidth|}
34
36
)
35
37
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
+
36
50
// Check that for both mobile and desktop sizes, the buttons in scraped examples are displayed
37
51
// correctly.
38
52
@@ -46,3 +60,32 @@ assert-position: (".scraped-example .prev", {"y": 226 + |offset_y|})
46
60
set-window-size: (600, 600)
47
61
assert-position: (".scraped-example", {"y": 284})
48
62
assert-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