|
| 1 | +// Checking the colors of the search tab headers. |
| 2 | +goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html?search=something" |
| 3 | +show-text: true |
| 4 | + |
| 5 | +define-function: ( |
| 6 | + "check-colors", |
| 7 | + (theme, background, background_selected, background_hover, border_bottom, |
| 8 | + border_bottom_selected, border_bottom_hover, border_top, border_top_selected, |
| 9 | + border_top_hover), |
| 10 | + [ |
| 11 | + // Setting the theme. |
| 12 | + ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}), |
| 13 | + ("reload"), |
| 14 | + |
| 15 | + // These two commands are used to be sure the search will be run. |
| 16 | + ("focus", ".search-input"), |
| 17 | + ("press-key", "Enter"), |
| 18 | + |
| 19 | + ("wait-for", "#search-tabs"), |
| 20 | + ("assert-css", ("#search-tabs > button:not(.selected)", { |
| 21 | + "background-color": |background|, |
| 22 | + "border-bottom": |border_bottom|, |
| 23 | + "border-top": |border_top|, |
| 24 | + })), |
| 25 | + ("assert-css", ("#search-tabs > button.selected", { |
| 26 | + "background-color": |background_selected|, |
| 27 | + "border-bottom": |border_bottom_selected|, |
| 28 | + "border-top": |border_top_selected|, |
| 29 | + })), |
| 30 | + ("move-cursor-to", "#search-tabs > button:not(.selected)"), |
| 31 | + ("assert-css", ("#search-tabs > button:not(.selected):hover", { |
| 32 | + "background-color": |background_hover|, |
| 33 | + "border-bottom": |border_bottom_hover|, |
| 34 | + "border-top": |border_top_hover|, |
| 35 | + })), |
| 36 | + // To prevent disrupting next run of this function. |
| 37 | + ("move-cursor-to", ".search-input"), |
| 38 | + ], |
| 39 | +) |
| 40 | + |
| 41 | +call-function: ("check-colors", { |
| 42 | + "theme": "ayu", |
| 43 | + "background": "rgba(0, 0, 0, 0)", |
| 44 | + "background_selected": "rgb(20, 25, 32)", |
| 45 | + "background_hover": "rgba(0, 0, 0, 0)", |
| 46 | + "border_bottom": "0px none rgb(197, 197, 197)", |
| 47 | + "border_bottom_selected": "1px solid rgb(255, 180, 76)", |
| 48 | + "border_bottom_hover": "1px solid rgba(242, 151, 24, 0.3)", |
| 49 | + "border_top": "0px none rgb(197, 197, 197)", |
| 50 | + "border_top_selected": "0px none rgb(197, 197, 197)", |
| 51 | + "border_top_hover": "0px none rgb(197, 197, 197)", |
| 52 | +}) |
| 53 | +call-function: ("check-colors", { |
| 54 | + "theme": "dark", |
| 55 | + "background": "rgb(37, 37, 37)", |
| 56 | + "background_selected": "rgb(53, 53, 53)", |
| 57 | + "background_hover": "rgb(53, 53, 53)", |
| 58 | + "border_bottom": "0px none rgb(221, 221, 221)", |
| 59 | + "border_bottom_selected": "0px none rgb(221, 221, 221)", |
| 60 | + "border_bottom_hover": "0px none rgb(221, 221, 221)", |
| 61 | + "border_top": "2px solid rgb(37, 37, 37)", |
| 62 | + "border_top_selected": "2px solid rgb(0, 137, 255)", |
| 63 | + "border_top_hover": "2px solid rgb(0, 137, 255)", |
| 64 | +}) |
| 65 | +call-function: ("check-colors", { |
| 66 | + "theme": "light", |
| 67 | + "background": "rgb(230, 230, 230)", |
| 68 | + "background_selected": "rgb(255, 255, 255)", |
| 69 | + "background_hover": "rgb(255, 255, 255)", |
| 70 | + "border_bottom": "0px none rgb(0, 0, 0)", |
| 71 | + "border_bottom_selected": "0px none rgb(0, 0, 0)", |
| 72 | + "border_bottom_hover": "0px none rgb(0, 0, 0)", |
| 73 | + "border_top": "2px solid rgb(230, 230, 230)", |
| 74 | + "border_top_selected": "2px solid rgb(0, 137, 255)", |
| 75 | + "border_top_hover": "2px solid rgb(0, 137, 255)", |
| 76 | +}) |
0 commit comments