1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
|
// This test checks links colors in sidebar before and after hover.
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
// This is needed so that the text color is computed.
show-text: true
define-function: (
"check-colors",
(
theme, struct, struct_hover, struct_hover_background, enum, enum_hover,
enum_hover_background, union, union_hover, union_hover_background, trait, trait_hover,
trait_hover_background, fn, fn_hover, fn_hover_background, type, type_hover,
type_hover_background, keyword, keyword_hover, keyword_hover_background,
),
block {
set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false" }
reload:
// Struct
assert-css: (
".sidebar .block.struct a:not(.current)",
{"color": |struct|, "background-color": "rgba(0, 0, 0, 0)"},
)
move-cursor-to: ".sidebar .block.struct a:not(.current)"
assert-css: (
".sidebar .block.struct a:hover",
{"color": |struct_hover|, "background-color": |struct_hover_background|},
)
// Enum
assert-css: (
".sidebar .block.enum a",
{"color": |enum|, "background-color": "rgba(0, 0, 0, 0)"},
)
move-cursor-to: ".sidebar .block.enum a"
assert-css: (
".sidebar .block.enum a:hover",
{"color": |enum_hover|, "background-color": |enum_hover_background|},
)
// Union
assert-css: (
".sidebar .block.union a",
{"color": |union|, "background-color": "rgba(0, 0, 0, 0)"},
)
move-cursor-to: ".sidebar .block.union a"
assert-css: (
".sidebar .block.union a:hover",
{"color": |union_hover|, "background-color": |union_hover_background|},
)
// Trait
assert-css: (
".sidebar .block.trait a",
{"color": |trait|, "background-color": "rgba(0, 0, 0, 0)"},
)
move-cursor-to: ".sidebar .block.trait a"
assert-css: (
".sidebar .block.trait a:hover",
{"color": |trait_hover|, "background-color": |trait_hover_background|},
)
// Function
assert-css: (
".sidebar .block.fn a",
{"color": |fn|, "background-color": "rgba(0, 0, 0, 0)"},
)
move-cursor-to: ".sidebar .block.fn a"
assert-css: (
".sidebar .block.fn a:hover",
{"color": |fn_hover|, "background-color": |fn_hover_background|},
)
// Type definition
assert-css: (
".sidebar .block.type a",
{"color": |type|, "background-color": "rgba(0, 0, 0, 0)"},
)
move-cursor-to: ".sidebar .block.type a"
assert-css: (
".sidebar .block.type a:hover",
{"color": |type_hover|, "background-color": |type_hover_background|},
)
// Keyword
assert-css: (
".sidebar .block.keyword a",
{"color": |keyword|, "background-color": "rgba(0, 0, 0, 0)"},
)
move-cursor-to: ".sidebar .block.keyword a"
assert-css: (
".sidebar .block.keyword a:hover",
{"color": |keyword_hover|, "background-color": |keyword_hover_background|},
)
}
)
call-function: (
"check-colors",
{
"theme": "ayu",
"struct": "rgb(83, 177, 219)",
"struct_hover": "rgb(255, 180, 76)",
"struct_hover_background": "rgba(0, 0, 0, 0)",
"enum": "rgb(83, 177, 219)",
"enum_hover": "rgb(255, 180, 76)",
"enum_hover_background": "rgba(0, 0, 0, 0)",
"union": "rgb(83, 177, 219)",
"union_hover": "rgb(255, 180, 76)",
"union_hover_background": "rgba(0, 0, 0, 0)",
"trait": "rgb(83, 177, 219)",
"trait_hover": "rgb(255, 180, 76)",
"trait_hover_background": "rgba(0, 0, 0, 0)",
"fn": "rgb(83, 177, 219)",
"fn_hover": "rgb(255, 180, 76)",
"fn_hover_background": "rgba(0, 0, 0, 0)",
"type": "rgb(83, 177, 219)",
"type_hover": "rgb(255, 180, 76)",
"type_hover_background": "rgba(0, 0, 0, 0)",
"keyword": "rgb(83, 177, 219)",
"keyword_hover": "rgb(255, 180, 76)",
"keyword_hover_background": "rgba(0, 0, 0, 0)",
}
)
call-function: (
"check-colors",
{
"theme": "dark",
"struct": "rgb(253, 191, 53)",
"struct_hover": "rgb(253, 191, 53)",
"struct_hover_background": "rgb(68, 68, 68)",
"enum": "rgb(253, 191, 53)",
"enum_hover": "rgb(253, 191, 53)",
"enum_hover_background": "rgb(68, 68, 68)",
"union": "rgb(253, 191, 53)",
"union_hover": "rgb(253, 191, 53)",
"union_hover_background": "rgb(68, 68, 68)",
"trait": "rgb(253, 191, 53)",
"trait_hover": "rgb(253, 191, 53)",
"trait_hover_background": "rgb(68, 68, 68)",
"fn": "rgb(253, 191, 53)",
"fn_hover": "rgb(253, 191, 53)",
"fn_hover_background": "rgb(68, 68, 68)",
"type": "rgb(253, 191, 53)",
"type_hover": "rgb(253, 191, 53)",
"type_hover_background": "rgb(68, 68, 68)",
"keyword": "rgb(253, 191, 53)",
"keyword_hover": "rgb(253, 191, 53)",
"keyword_hover_background": "rgb(68, 68, 68)",
}
)
call-function: (
"check-colors",
{
"theme": "light",
"struct": "rgb(53, 109, 164)",
"struct_hover": "rgb(53, 109, 164)",
"struct_hover_background": "rgb(255, 255, 255)",
"enum": "rgb(53, 109, 164)",
"enum_hover": "rgb(53, 109, 164)",
"enum_hover_background": "rgb(255, 255, 255)",
"union": "rgb(53, 109, 164)",
"union_hover": "rgb(53, 109, 164)",
"union_hover_background": "rgb(255, 255, 255)",
"trait": "rgb(53, 109, 164)",
"trait_hover": "rgb(53, 109, 164)",
"trait_hover_background": "rgb(255, 255, 255)",
"fn": "rgb(53, 109, 164)",
"fn_hover": "rgb(53, 109, 164)",
"fn_hover_background": "rgb(255, 255, 255)",
"type": "rgb(53, 109, 164)",
"type_hover": "rgb(53, 109, 164)",
"type_hover_background": "rgb(255, 255, 255)",
"keyword": "rgb(53, 109, 164)",
"keyword_hover": "rgb(53, 109, 164)",
"keyword_hover_background": "rgb(255, 255, 255)",
}
)
|