2022-10-13 09:51:04 -05:00
|
|
|
// Check position and color of the `<sup>` for unsafe elements.
|
2022-10-08 11:36:37 -05:00
|
|
|
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
|
|
|
// If the text isn't displayed, the browser doesn't compute color style correctly...
|
|
|
|
show-text: true
|
|
|
|
|
2022-10-13 09:51:04 -05:00
|
|
|
compare-elements-property: (
|
2023-01-23 15:31:35 -06:00
|
|
|
"//a[@title='fn test_docs::safe_fn']/..",
|
|
|
|
"//a[@title='fn test_docs::unsafe_fn']/..",
|
2022-10-13 09:51:04 -05:00
|
|
|
["clientHeight"]
|
|
|
|
)
|
2022-10-08 11:36:37 -05:00
|
|
|
|
2022-10-13 09:51:04 -05:00
|
|
|
define-function: (
|
|
|
|
"sup-check",
|
|
|
|
// `theme` is the theme being tested.
|
|
|
|
// `color` is the expected color of the `<sup>` element.
|
|
|
|
(theme, color),
|
2023-01-06 08:18:51 -06:00
|
|
|
block {
|
2022-10-13 09:51:04 -05:00
|
|
|
// Set the theme.
|
2023-01-06 08:18:51 -06:00
|
|
|
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
|
2022-10-13 09:51:04 -05:00
|
|
|
// We reload the page so the local storage settings are being used.
|
2023-01-06 08:18:51 -06:00
|
|
|
reload:
|
|
|
|
assert-css: (".item-left sup", {"color": |color|})
|
|
|
|
},
|
2022-10-13 09:51:04 -05:00
|
|
|
)
|
2022-10-08 11:36:37 -05:00
|
|
|
|
2022-10-13 09:51:04 -05:00
|
|
|
call-function: ("sup-check", ("dark", "rgb(221, 221, 221)"))
|
|
|
|
call-function: ("sup-check", ("ayu", "rgb(197, 197, 197)"))
|
|
|
|
call-function: ("sup-check", ("light", "rgb(0, 0, 0)"))
|