rust/tests/rustdoc-gui/item-decl-colors.goml
2024-04-05 21:38:55 +02:00

84 lines
2.5 KiB
Plaintext

// This test ensures that the color of the items in the type decl are working as expected.
include: "utils.goml"
// We need to disable this check because `trait.impl/test_docs/trait.TraitWithoutGenerics.js`
// doesn't exist.
fail-on-request-error: false
define-function: (
"check-colors",
[
theme,
attr_color,
trait_color,
struct_color,
enum_color,
primitive_color,
constant_color,
fn_color,
assoc_type_color,
],
block {
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.WithGenerics.html"
show-text: true
call-function: ("switch-theme", {"theme": |theme|})
assert-css: (".item-decl .code-attribute", {"color": |attr_color|}, ALL)
assert-css: (".item-decl .trait", {"color": |trait_color|}, ALL)
// We need to add `code` here because otherwise it would select the parent too.
assert-css: (".item-decl code .struct", {"color": |struct_color|}, ALL)
assert-css: (".item-decl .enum", {"color": |enum_color|}, ALL)
assert-css: (".item-decl .primitive", {"color": |primitive_color|}, ALL)
go-to: "file://" + |DOC_PATH| + "/test_docs/trait.TraitWithoutGenerics.html"
assert-css: (".item-decl .constant", {"color": |constant_color|}, ALL)
assert-css: (".item-decl .fn", {"color": |fn_color|}, ALL)
assert-css: (".item-decl .associatedtype", {"color": |assoc_type_color|}, ALL)
},
)
call-function: (
"check-colors",
{
"theme": "ayu",
"attr_color": "#999",
"trait_color": "#39afd7",
"struct_color": "#ffa0a5",
"enum_color": "#ffa0a5",
"primitive_color": "#ffa0a5",
"constant_color": "#39afd7",
"fn_color": "#fdd687",
"assoc_type_color": "#39afd7",
},
)
call-function: (
"check-colors",
{
"theme": "dark",
"attr_color": "#999",
"trait_color": "#b78cf2",
"struct_color": "#2dbfb8",
"enum_color": "#2dbfb8",
"primitive_color": "#2dbfb8",
"constant_color": "#d2991d",
"fn_color": "#2bab63",
"assoc_type_color": "#d2991d",
},
)
call-function: (
"check-colors",
{
"theme": "light",
"attr_color": "#999",
"trait_color": "#6e4fc9",
"struct_color": "#ad378a",
"enum_color": "#ad378a",
"primitive_color": "#ad378a",
"constant_color": "#3873ad",
"fn_color": "#ad7c37",
"assoc_type_color": "#3873ad",
},
)