|
1 | 1 | // Example code blocks sometimes have a "Run" button to run them on the
|
2 | 2 | // Playground. That button is hidden until the user hovers over the code block.
|
3 |
| -// This test checks that it is hidden, and that it shows on hover. |
| 3 | +// This test checks that it is hidden, and that it shows on hover. It also |
| 4 | +// checks for its color. |
4 | 5 | goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
|
5 |
| -assert-css: (".test-arrow", {"visibility": "hidden"}) |
6 |
| -move-cursor-to: ".example-wrap" |
7 |
| -assert-css: (".test-arrow", {"visibility": "visible"}) |
| 6 | +show-text: true |
| 7 | + |
| 8 | +define-function: ( |
| 9 | + "check-run-button", |
| 10 | + (theme, color, background, hover_color, hover_background), |
| 11 | + [ |
| 12 | + ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}), |
| 13 | + ("reload"), |
| 14 | + ("assert-css", (".test-arrow", {"visibility": "hidden"})), |
| 15 | + ("move-cursor-to", ".example-wrap"), |
| 16 | + ("assert-css", (".test-arrow", { |
| 17 | + "visibility": "visible", |
| 18 | + "color": |color|, |
| 19 | + "background-color": |background|, |
| 20 | + "font-size": "22px", |
| 21 | + "border-radius": "5px", |
| 22 | + })), |
| 23 | + ("move-cursor-to", ".test-arrow"), |
| 24 | + ("assert-css", (".test-arrow:hover", { |
| 25 | + "visibility": "visible", |
| 26 | + "color": |hover_color|, |
| 27 | + "background-color": |hover_background|, |
| 28 | + "font-size": "22px", |
| 29 | + "border-radius": "5px", |
| 30 | + })), |
| 31 | + ], |
| 32 | +) |
| 33 | + |
| 34 | +call-function: ("check-run-button", { |
| 35 | + "theme": "ayu", |
| 36 | + "color": "rgb(120, 135, 151)", |
| 37 | + "background": "rgba(57, 175, 215, 0.09)", |
| 38 | + "hover_color": "rgb(197, 197, 197)", |
| 39 | + "hover_background": "rgba(57, 175, 215, 0.37)", |
| 40 | +}) |
| 41 | +call-function: ("check-run-button", { |
| 42 | + "theme": "dark", |
| 43 | + "color": "rgb(222, 222, 222)", |
| 44 | + "background": "rgba(78, 139, 202, 0.2)", |
| 45 | + "hover_color": "rgb(222, 222, 222)", |
| 46 | + "hover_background": "rgb(78, 139, 202)", |
| 47 | +}) |
| 48 | +call-function: ("check-run-button", { |
| 49 | + "theme": "light", |
| 50 | + "color": "rgb(245, 245, 245)", |
| 51 | + "background": "rgba(78, 139, 202, 0.2)", |
| 52 | + "hover_color": "rgb(245, 245, 245)", |
| 53 | + "hover_background": "rgb(78, 139, 202)", |
| 54 | +}) |
0 commit comments