|
1 | 1 | // The goal of this test is to ensure that the sidebar is working as expected in the source |
2 | 2 | // code pages. |
3 | 3 | goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" |
4 | | -// First: desktop mode. |
| 4 | +show-text: true |
| 5 | + |
| 6 | +// First, check the sidebar colors. |
| 7 | +define-function: ( |
| 8 | + "check-colors", |
| 9 | + (theme, color, background_color), |
| 10 | + [ |
| 11 | + ("local-storage", { |
| 12 | + "rustdoc-theme": |theme|, |
| 13 | + "rustdoc-use-system-theme": "false", |
| 14 | + }), |
| 15 | + ("reload"), |
| 16 | + // Checking results colors. |
| 17 | + ("assert-css", (".source .sidebar", { |
| 18 | + "color": |color|, |
| 19 | + "background-color": |background_color| |
| 20 | + }, ALL)), |
| 21 | + ], |
| 22 | +) |
| 23 | + |
| 24 | +call-function: ( |
| 25 | + "check-colors", |
| 26 | + { |
| 27 | + "theme": "ayu", |
| 28 | + "color": "rgb(197, 197, 197)", |
| 29 | + "background_color": "rgb(20, 25, 31)", |
| 30 | + } |
| 31 | +) |
| 32 | +call-function: ( |
| 33 | + "check-colors", |
| 34 | + { |
| 35 | + "theme": "dark", |
| 36 | + "color": "rgb(221, 221, 221)", |
| 37 | + "background_color": "rgb(80, 80, 80)", |
| 38 | + } |
| 39 | +) |
| 40 | +call-function: ( |
| 41 | + "check-colors", |
| 42 | + { |
| 43 | + "theme": "light", |
| 44 | + "color": "rgb(0, 0, 0)", |
| 45 | + "background_color": "rgb(245, 245, 245)", |
| 46 | + } |
| 47 | +) |
| 48 | + |
| 49 | +// Next, desktop mode layout. |
5 | 50 | size: (1100, 800) |
6 | 51 | // We check that the sidebar isn't expanded and has the expected width. |
7 | 52 | assert-css: ("nav.sidebar", {"width": "50px"}) |
|
0 commit comments