1
1
// Checks that the interactions with the source code pages are working as expected.
2
2
goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
3
+ show-text: true
3
4
// Check that we can click on the line number.
4
5
click: ".src-line-numbers > span:nth-child(4)" // This is the span for line 4.
5
6
// Ensure that the page URL was updated.
@@ -12,6 +13,48 @@ assert-attribute: (".src-line-numbers > span:nth-child(4)", {"class": "line-high
12
13
assert-attribute: (".src-line-numbers > span:nth-child(5)", {"class": "line-highlighted"})
13
14
assert-attribute: (".src-line-numbers > span:nth-child(6)", {"class": "line-highlighted"})
14
15
assert-attribute-false: (".src-line-numbers > span:nth-child(7)", {"class": "line-highlighted"})
16
+
17
+ define-function: (
18
+ "check-colors",
19
+ (theme, color, background_color, highlight_color, highlight_background_color),
20
+ [
21
+ ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
22
+ ("reload"),
23
+ ("assert-css", (
24
+ ".src-line-numbers > span:not(.line-highlighted)",
25
+ {"color": |color|, "background-color": |background_color|},
26
+ ALL,
27
+ )),
28
+ ("assert-css", (
29
+ ".src-line-numbers > span.line-highlighted",
30
+ {"color": |highlight_color|, "background-color": |highlight_background_color|},
31
+ ALL,
32
+ )),
33
+ ],
34
+ )
35
+
36
+ call-function: ("check-colors", {
37
+ "theme": "ayu",
38
+ "color": "rgb(92, 103, 115)",
39
+ "background_color": "rgba(0, 0, 0, 0)",
40
+ "highlight_color": "rgb(112, 128, 144)",
41
+ "highlight_background_color": "rgba(255, 236, 164, 0.06)",
42
+ })
43
+ call-function: ("check-colors", {
44
+ "theme": "dark",
45
+ "color": "rgb(59, 145, 226)",
46
+ "background_color": "rgba(0, 0, 0, 0)",
47
+ "highlight_color": "rgb(59, 145, 226)",
48
+ "highlight_background_color": "rgb(10, 4, 47)",
49
+ })
50
+ call-function: ("check-colors", {
51
+ "theme": "light",
52
+ "color": "rgb(198, 126, 45)",
53
+ "background_color": "rgba(0, 0, 0, 0)",
54
+ "highlight_color": "rgb(198, 126, 45)",
55
+ "highlight_background_color": "rgb(253, 255, 211)",
56
+ })
57
+
15
58
// This is to ensure that the content is correctly align with the line numbers.
16
59
compare-elements-position: ("//*[@id='1']", ".rust > code > span", ("y"))
17
60
@@ -20,7 +63,6 @@ assert-css: (".src-line-numbers", {"text-align": "right"})
20
63
21
64
// Now let's check that clicking on something else than the line number doesn't
22
65
// do anything (and certainly not add a `#NaN` to the URL!).
23
- show-text: true
24
66
goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
25
67
// We use this assert-position to know where we will click.
26
68
assert-position: ("//*[@id='1']", {"x": 104, "y": 112})
0 commit comments