|
1 | 1 | // We check the background color on the jump to definition links in the source code page.
|
2 | 2 | goto: "file://" + |DOC_PATH| + "/src/link_to_definition/lib.rs.html"
|
3 | 3 |
|
4 |
| -// Set the theme to dark. |
5 |
| -local-storage: { |
6 |
| - "rustdoc-theme": "dark", |
7 |
| - "rustdoc-preferred-dark-theme": "dark", |
8 |
| - "rustdoc-use-system-theme": "false", |
9 |
| -} |
10 |
| -// We reload the page so the local storage settings are being used. |
11 |
| -reload: |
12 |
| - |
13 |
| -assert-css: ( |
14 |
| - "body.source .example-wrap pre.rust a", |
15 |
| - {"background-color": "rgb(51, 51, 51)"}, |
16 |
| - ALL, |
17 |
| -) |
18 |
| - |
19 |
| -// Set the theme to ayu. |
20 |
| -local-storage: { |
21 |
| - "rustdoc-theme": "ayu", |
22 |
| - "rustdoc-preferred-dark-theme": "ayu", |
23 |
| - "rustdoc-use-system-theme": "false", |
24 |
| -} |
25 |
| -// We reload the page so the local storage settings are being used. |
26 |
| -reload: |
27 |
| - |
28 |
| -assert-css: ( |
29 |
| - "body.source .example-wrap pre.rust a", |
30 |
| - {"background-color": "rgb(51, 51, 51)"}, |
31 |
| - ALL, |
| 4 | +define-function: ( |
| 5 | + "check-background-color", |
| 6 | + (theme, background_color), |
| 7 | + [ |
| 8 | + // Set the theme. |
| 9 | + ("local-storage", { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false" }), |
| 10 | + // We reload the page so the local storage settings are being used. |
| 11 | + ("reload"), |
| 12 | + ("assert-css", ( |
| 13 | + "body.source .example-wrap pre.rust a", |
| 14 | + {"background-color": |background_color|}, |
| 15 | + ALL, |
| 16 | + )), |
| 17 | + ], |
32 | 18 | )
|
33 | 19 |
|
34 |
| -// Set the theme to light. |
35 |
| -local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} |
36 |
| -// We reload the page so the local storage settings are being used. |
37 |
| -reload: |
38 |
| - |
39 |
| -assert-css: ( |
40 |
| - "body.source .example-wrap pre.rust a", |
41 |
| - {"background-color": "rgb(238, 238, 238)"}, |
42 |
| - ALL, |
43 |
| -) |
| 20 | +call-function: ("check-background-color", ("ayu", "rgb(51, 51, 51)")) |
| 21 | +call-function: ("check-background-color", ("dark", "rgb(51, 51, 51)")) |
| 22 | +call-function: ("check-background-color", ("light", "rgb(238, 238, 238)")) |
0 commit comments