2022-09-19 12:32:30 +02:00
|
|
|
// This test checks the position of the `i` for the notable traits.
|
2022-10-07 20:17:05 +02:00
|
|
|
goto: "file://" + |DOC_PATH| + "/test_docs/struct.NotableStructWithLongName.html"
|
2022-09-19 12:32:30 +02:00
|
|
|
show-text: true
|
|
|
|
// We start with a wide screen.
|
|
|
|
size: (1100, 600)
|
|
|
|
// Checking they have the same y position.
|
|
|
|
compare-elements-position: (
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
|
|
|
|
("y"),
|
|
|
|
)
|
|
|
|
// Checking they don't have the same x position.
|
|
|
|
compare-elements-position-false: (
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
|
|
|
|
("x"),
|
|
|
|
)
|
|
|
|
// The `i` should be *after* the type.
|
|
|
|
assert-position: (
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
|
2022-09-22 11:51:48 -07:00
|
|
|
{"x": 677},
|
2022-09-19 12:32:30 +02:00
|
|
|
)
|
|
|
|
assert-position: (
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
|
2022-11-08 18:00:22 -07:00
|
|
|
{"x": 955},
|
2022-09-19 12:32:30 +02:00
|
|
|
)
|
2022-11-08 18:00:22 -07:00
|
|
|
// The tooltip should be below the `i`
|
2022-11-07 15:53:30 -07:00
|
|
|
// Also, clicking the tooltip should bring its text into the DOM
|
2022-11-08 18:00:22 -07:00
|
|
|
assert-count: ("//*[@class='notable popover']", 0)
|
2022-10-26 14:42:53 -07:00
|
|
|
click: "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']"
|
2022-11-08 18:00:22 -07:00
|
|
|
assert-count: ("//*[@class='notable popover']", 1)
|
2022-10-26 14:42:53 -07:00
|
|
|
compare-elements-position-near: (
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
|
2022-11-08 18:00:22 -07:00
|
|
|
"//*[@class='notable popover']",
|
|
|
|
{"y": 30}
|
2022-10-26 14:42:53 -07:00
|
|
|
)
|
|
|
|
compare-elements-position-false: (
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
|
2022-11-08 18:00:22 -07:00
|
|
|
"//*[@class='notable popover']",
|
2022-10-26 14:42:53 -07:00
|
|
|
("x")
|
|
|
|
)
|
2022-11-07 15:53:30 -07:00
|
|
|
click: "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']"
|
|
|
|
move-cursor-to: "//h1"
|
2022-11-08 18:00:22 -07:00
|
|
|
assert-count: ("//*[@class='notable popover']", 0)
|
2022-09-19 12:32:30 +02:00
|
|
|
|
|
|
|
// Now only the `i` should be on the next line.
|
|
|
|
size: (1055, 600)
|
|
|
|
compare-elements-position-false: (
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
|
|
|
|
("y", "x"),
|
|
|
|
)
|
|
|
|
|
|
|
|
// Now both the `i` and the struct name should be on the next line.
|
|
|
|
size: (980, 600)
|
|
|
|
// Checking they have the same y position.
|
|
|
|
compare-elements-position: (
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
|
|
|
|
("y"),
|
|
|
|
)
|
|
|
|
// Checking they don't have the same x position.
|
|
|
|
compare-elements-position-false: (
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
|
|
|
|
("x"),
|
|
|
|
)
|
|
|
|
// The `i` should be *after* the type.
|
|
|
|
assert-position: (
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
|
|
|
|
{"x": 245},
|
|
|
|
)
|
|
|
|
assert-position: (
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
|
2022-11-08 18:00:22 -07:00
|
|
|
{"x": 523},
|
2022-09-19 12:32:30 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// Checking on mobile now.
|
|
|
|
size: (650, 600)
|
|
|
|
// Checking they have the same y position.
|
|
|
|
compare-elements-position: (
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
|
|
|
|
("y"),
|
|
|
|
)
|
|
|
|
// Checking they don't have the same x position.
|
|
|
|
compare-elements-position-false: (
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
|
|
|
|
("x"),
|
|
|
|
)
|
|
|
|
// The `i` should be *after* the type.
|
|
|
|
assert-position: (
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
|
|
|
|
{"x": 15},
|
|
|
|
)
|
|
|
|
assert-position: (
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
|
2022-11-08 18:00:22 -07:00
|
|
|
{"x": 293},
|
2022-09-19 12:32:30 +02:00
|
|
|
)
|
2022-11-08 18:00:22 -07:00
|
|
|
// The tooltip should STILL be below `i`
|
2022-11-07 15:53:30 -07:00
|
|
|
click: "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']"
|
2022-11-08 18:00:22 -07:00
|
|
|
assert-count: ("//*[@class='notable popover']", 1)
|
|
|
|
compare-elements-position-near: (
|
2022-10-26 14:42:53 -07:00
|
|
|
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
|
2022-11-08 18:00:22 -07:00
|
|
|
"//*[@class='notable popover']",
|
|
|
|
{"y": 30}
|
2022-10-26 14:42:53 -07:00
|
|
|
)
|
|
|
|
compare-elements-position-false: (
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
|
2022-11-08 18:00:22 -07:00
|
|
|
"//*[@class='notable popover']",
|
2022-10-26 14:42:53 -07:00
|
|
|
("x")
|
|
|
|
)
|
2022-11-08 18:00:22 -07:00
|
|
|
assert-position: (
|
|
|
|
"//*[@class='notable popover']",
|
|
|
|
{"x": 0}
|
2022-10-26 14:42:53 -07:00
|
|
|
)
|
2022-11-07 15:53:30 -07:00
|
|
|
click: "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']"
|
|
|
|
move-cursor-to: "//h1"
|
2022-11-08 18:00:22 -07:00
|
|
|
assert-count: ("//*[@class='notable popover']", 0)
|
2022-09-19 12:32:30 +02:00
|
|
|
|
|
|
|
// Checking on very small mobile. The `i` should be on its own line.
|
2022-09-21 17:29:47 -07:00
|
|
|
size: (365, 600)
|
2022-09-19 12:32:30 +02:00
|
|
|
compare-elements-position-false: (
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
|
|
|
|
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
|
|
|
|
("y", "x"),
|
|
|
|
)
|
2022-11-07 21:18:01 -07:00
|
|
|
|
|
|
|
// Now check the colors.
|
|
|
|
define-function: (
|
|
|
|
"check-colors",
|
|
|
|
(theme, header_color, content_color, type_color, trait_color),
|
|
|
|
[
|
|
|
|
("goto", "file://" + |DOC_PATH| + "/test_docs/struct.NotableStructWithLongName.html"),
|
|
|
|
// This is needed to ensure that the text color is computed.
|
|
|
|
("show-text", true),
|
|
|
|
|
|
|
|
// Setting the theme.
|
|
|
|
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
|
|
|
|
// We reload the page so the local storage settings are being used.
|
|
|
|
("reload"),
|
|
|
|
|
|
|
|
("move-cursor-to", "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']"),
|
2022-11-08 18:00:22 -07:00
|
|
|
("assert-count", (".notable.popover", 1)),
|
2022-11-07 21:18:01 -07:00
|
|
|
|
|
|
|
("assert-css", (
|
2022-11-08 18:00:22 -07:00
|
|
|
".notable.popover h3",
|
2022-11-07 21:18:01 -07:00
|
|
|
{"color": |header_color|},
|
|
|
|
ALL,
|
|
|
|
)),
|
|
|
|
("assert-css", (
|
2022-11-08 18:00:22 -07:00
|
|
|
".notable.popover pre",
|
2022-11-07 21:18:01 -07:00
|
|
|
{"color": |content_color|},
|
|
|
|
ALL,
|
|
|
|
)),
|
|
|
|
("assert-css", (
|
2022-11-08 18:00:22 -07:00
|
|
|
".notable.popover pre a.struct",
|
2022-11-07 21:18:01 -07:00
|
|
|
{"color": |type_color|},
|
|
|
|
ALL,
|
|
|
|
)),
|
|
|
|
("assert-css", (
|
2022-11-08 18:00:22 -07:00
|
|
|
".notable.popover pre a.trait",
|
2022-11-07 21:18:01 -07:00
|
|
|
{"color": |trait_color|},
|
|
|
|
ALL,
|
|
|
|
)),
|
|
|
|
]
|
|
|
|
)
|
|
|
|
|
|
|
|
call-function: (
|
|
|
|
"check-colors",
|
|
|
|
{
|
|
|
|
"theme": "ayu",
|
|
|
|
"content_color": "rgb(230, 225, 207)",
|
|
|
|
"header_color": "rgb(255, 255, 255)",
|
|
|
|
"type_color": "rgb(255, 160, 165)",
|
|
|
|
"trait_color": "rgb(57, 175, 215)",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
call-function: (
|
|
|
|
"check-colors",
|
|
|
|
{
|
|
|
|
"theme": "dark",
|
|
|
|
"content_color": "rgb(221, 221, 221)",
|
|
|
|
"header_color": "rgb(221, 221, 221)",
|
|
|
|
"type_color": "rgb(45, 191, 184)",
|
|
|
|
"trait_color": "rgb(183, 140, 242)",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
call-function: (
|
|
|
|
"check-colors",
|
|
|
|
{
|
|
|
|
"theme": "light",
|
|
|
|
"content_color": "rgb(0, 0, 0)",
|
|
|
|
"header_color": "rgb(0, 0, 0)",
|
|
|
|
"type_color": "rgb(173, 55, 138)",
|
|
|
|
"trait_color": "rgb(110, 79, 201)",
|
|
|
|
},
|
|
|
|
)
|