2022-12-20 17:32:35 +00:00
|
|
|
// Check that the line number column has the correct layout.
|
2023-04-11 17:11:34 +00:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
|
2022-12-20 17:32:35 +00:00
|
|
|
|
2024-09-01 13:00:51 +00:00
|
|
|
set-window-size: (1000, 1000)
|
|
|
|
|
2022-12-20 17:32:35 +00:00
|
|
|
// Check that it's not zero.
|
|
|
|
assert-property-false: (
|
2024-08-30 22:12:10 +00:00
|
|
|
".more-scraped-examples .scraped-example .src-line-numbers",
|
2022-12-20 17:32:35 +00:00
|
|
|
{"clientWidth": "0"}
|
|
|
|
)
|
|
|
|
|
|
|
|
// Check that examples with very long lines have the same width as ones that don't.
|
|
|
|
store-property: (
|
2024-08-30 22:12:10 +00:00
|
|
|
".more-scraped-examples .scraped-example:nth-child(2) .src-line-numbers",
|
2023-05-10 08:56:59 +00:00
|
|
|
{"clientWidth": clientWidth},
|
2022-12-20 17:32:35 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
assert-property: (
|
2024-08-30 22:12:10 +00:00
|
|
|
".more-scraped-examples .scraped-example:nth-child(3) .src-line-numbers",
|
2022-12-20 17:32:35 +00:00
|
|
|
{"clientWidth": |clientWidth|}
|
|
|
|
)
|
|
|
|
|
|
|
|
assert-property: (
|
2024-08-30 22:12:10 +00:00
|
|
|
".more-scraped-examples .scraped-example:nth-child(4) .src-line-numbers",
|
2022-12-20 17:32:35 +00:00
|
|
|
{"clientWidth": |clientWidth|}
|
|
|
|
)
|
|
|
|
|
|
|
|
assert-property: (
|
2024-08-30 22:12:10 +00:00
|
|
|
".more-scraped-examples .scraped-example:nth-child(5) .src-line-numbers",
|
2022-12-20 17:32:35 +00:00
|
|
|
{"clientWidth": |clientWidth|}
|
|
|
|
)
|
|
|
|
|
|
|
|
assert-property: (
|
2024-08-30 22:12:10 +00:00
|
|
|
".more-scraped-examples .scraped-example:nth-child(6) .src-line-numbers",
|
2022-12-20 17:32:35 +00:00
|
|
|
{"clientWidth": |clientWidth|}
|
|
|
|
)
|
2022-12-30 15:27:56 +00:00
|
|
|
|
2024-09-01 13:00:51 +00:00
|
|
|
// The "title" should be located at the right bottom corner of the code example.
|
2024-09-02 13:59:00 +00:00
|
|
|
store-position: (".scraped-example .example-wrap", {"x": x, "y": y})
|
|
|
|
store-size: (".scraped-example .example-wrap", {"width": width, "height": height})
|
|
|
|
store-size: (".scraped-example .scraped-example-title", {
|
2024-09-01 13:00:51 +00:00
|
|
|
"width": title_width,
|
|
|
|
"height": title_height,
|
|
|
|
})
|
2024-09-02 13:59:00 +00:00
|
|
|
assert-position: (".scraped-example .scraped-example-title", {
|
2024-09-01 13:00:51 +00:00
|
|
|
"x": |x| + |width| - |title_width| - 5,
|
|
|
|
"y": |y| + |height| - |title_height| - 8,
|
|
|
|
})
|
|
|
|
|
2022-12-30 15:27:56 +00:00
|
|
|
// Check that for both mobile and desktop sizes, the buttons in scraped examples are displayed
|
|
|
|
// correctly.
|
|
|
|
|
|
|
|
store-value: (offset_y, 4)
|
|
|
|
|
|
|
|
// First with desktop
|
2024-08-30 22:12:10 +00:00
|
|
|
assert-position: (".scraped-example", {"y": 226})
|
|
|
|
assert-position: (".scraped-example .prev", {"y": 226 + |offset_y|})
|
2022-12-30 15:27:56 +00:00
|
|
|
|
2024-09-01 21:59:46 +00:00
|
|
|
// Gradient background should be at the top of the code block.
|
2024-09-02 13:59:00 +00:00
|
|
|
assert-css: (".scraped-example .example-wrap::before", {"top": "0px"})
|
|
|
|
assert-css: (".scraped-example .example-wrap::after", {"bottom": "0px"})
|
2024-09-01 21:59:46 +00:00
|
|
|
|
2022-12-30 15:27:56 +00:00
|
|
|
// Then with mobile
|
2023-04-11 17:11:34 +00:00
|
|
|
set-window-size: (600, 600)
|
2024-09-02 13:59:00 +00:00
|
|
|
store-size: (".scraped-example .scraped-example-title", {"height": title_height})
|
2024-08-30 22:12:10 +00:00
|
|
|
assert-position: (".scraped-example", {"y": 284})
|
2024-09-01 21:59:46 +00:00
|
|
|
assert-position: (".scraped-example .prev", {"y": 284 + |offset_y| + |title_height|})
|
|
|
|
|
2024-09-01 13:00:51 +00:00
|
|
|
define-function: (
|
|
|
|
"check_title_and_code_position",
|
|
|
|
[],
|
|
|
|
block {
|
|
|
|
// Title should be above the code.
|
2024-09-02 13:59:00 +00:00
|
|
|
store-position: (".scraped-example .example-wrap .src-line-numbers", {"x": x, "y": y})
|
|
|
|
store-size: (".scraped-example .scraped-example-title", { "height": title_height })
|
2024-09-01 13:00:51 +00:00
|
|
|
|
2024-09-02 13:59:00 +00:00
|
|
|
assert-position: (".scraped-example .scraped-example-title", {
|
2024-09-01 13:00:51 +00:00
|
|
|
"x": |x|, // same X position.
|
|
|
|
"y": |y| - |title_height|,
|
|
|
|
})
|
|
|
|
|
|
|
|
// Line numbers should be right beside the code.
|
|
|
|
compare-elements-position: (
|
2024-09-02 13:59:00 +00:00
|
|
|
".scraped-example .example-wrap .src-line-numbers",
|
|
|
|
".scraped-example .example-wrap .rust",
|
2024-09-01 13:00:51 +00:00
|
|
|
["y"],
|
|
|
|
)
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
// Check that the title is now above the code.
|
|
|
|
call-function: ("check_title_and_code_position", {})
|
|
|
|
|
|
|
|
// Then with small mobile
|
|
|
|
set-window-size: (300, 300)
|
|
|
|
call-function: ("check_title_and_code_position", {})
|