Add tests for source line numbers colors
This commit is contained in:
parent
0185be2ce4
commit
71e824de26
1 changed files with 43 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
// Checks that the interactions with the source code pages are working as expected.
|
||||
goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
|
||||
show-text: true
|
||||
// Check that we can click on the line number.
|
||||
click: ".src-line-numbers > span:nth-child(4)" // This is the span for line 4.
|
||||
// Ensure that the page URL was updated.
|
||||
|
@ -12,6 +13,48 @@ assert-attribute: (".src-line-numbers > span:nth-child(4)", {"class": "line-high
|
|||
assert-attribute: (".src-line-numbers > span:nth-child(5)", {"class": "line-highlighted"})
|
||||
assert-attribute: (".src-line-numbers > span:nth-child(6)", {"class": "line-highlighted"})
|
||||
assert-attribute-false: (".src-line-numbers > span:nth-child(7)", {"class": "line-highlighted"})
|
||||
|
||||
define-function: (
|
||||
"check-colors",
|
||||
(theme, color, background_color, highlight_color, highlight_background_color),
|
||||
[
|
||||
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
|
||||
("reload"),
|
||||
("assert-css", (
|
||||
".src-line-numbers > span:not(.line-highlighted)",
|
||||
{"color": |color|, "background-color": |background_color|},
|
||||
ALL,
|
||||
)),
|
||||
("assert-css", (
|
||||
".src-line-numbers > span.line-highlighted",
|
||||
{"color": |highlight_color|, "background-color": |highlight_background_color|},
|
||||
ALL,
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
||||
call-function: ("check-colors", {
|
||||
"theme": "ayu",
|
||||
"color": "rgb(92, 103, 115)",
|
||||
"background_color": "rgba(0, 0, 0, 0)",
|
||||
"highlight_color": "rgb(112, 128, 144)",
|
||||
"highlight_background_color": "rgba(255, 236, 164, 0.06)",
|
||||
})
|
||||
call-function: ("check-colors", {
|
||||
"theme": "dark",
|
||||
"color": "rgb(59, 145, 226)",
|
||||
"background_color": "rgba(0, 0, 0, 0)",
|
||||
"highlight_color": "rgb(59, 145, 226)",
|
||||
"highlight_background_color": "rgb(10, 4, 47)",
|
||||
})
|
||||
call-function: ("check-colors", {
|
||||
"theme": "light",
|
||||
"color": "rgb(198, 126, 45)",
|
||||
"background_color": "rgba(0, 0, 0, 0)",
|
||||
"highlight_color": "rgb(198, 126, 45)",
|
||||
"highlight_background_color": "rgb(253, 255, 211)",
|
||||
})
|
||||
|
||||
// This is to ensure that the content is correctly align with the line numbers.
|
||||
compare-elements-position: ("//*[@id='1']", ".rust > code > span", ("y"))
|
||||
|
||||
|
@ -20,7 +63,6 @@ assert-css: (".src-line-numbers", {"text-align": "right"})
|
|||
|
||||
// Now let's check that clicking on something else than the line number doesn't
|
||||
// do anything (and certainly not add a `#NaN` to the URL!).
|
||||
show-text: true
|
||||
goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
|
||||
// We use this assert-position to know where we will click.
|
||||
assert-position: ("//*[@id='1']", {"x": 104, "y": 112})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue