• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// This test ensures that the color of the items in the type decl are working as expected.
2
3// We need to disable this check because `implementors/test_docs/trait.TraitWithoutGenerics.js`
4// doesn't exist.
5fail-on-request-error: false
6
7define-function: (
8    "check-colors",
9    (
10        theme,
11        attr_color,
12        trait_color,
13        struct_color,
14        enum_color,
15        primitive_color,
16        constant_color,
17        fn_color,
18        assoc_type_color,
19    ),
20    block {
21        go-to: "file://" + |DOC_PATH| + "/test_docs/struct.WithGenerics.html"
22        show-text: true
23        set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
24        reload:
25        assert-css: (".item-decl .code-attribute", {"color": |attr_color|}, ALL)
26        assert-css: (".item-decl .trait", {"color": |trait_color|}, ALL)
27        // We need to add `code` here because otherwise it would select the parent too.
28        assert-css: (".item-decl code .struct", {"color": |struct_color|}, ALL)
29        assert-css: (".item-decl .enum", {"color": |enum_color|}, ALL)
30        assert-css: (".item-decl .primitive", {"color": |primitive_color|}, ALL)
31
32        go-to: "file://" + |DOC_PATH| + "/test_docs/trait.TraitWithoutGenerics.html"
33        assert-css: (".item-decl .constant", {"color": |constant_color|}, ALL)
34        assert-css: (".item-decl .fn", {"color": |fn_color|}, ALL)
35        assert-css: (".item-decl .associatedtype", {"color": |assoc_type_color|}, ALL)
36    },
37)
38
39call-function: (
40    "check-colors",
41    {
42        "theme": "ayu",
43        "attr_color": "rgb(153, 153, 153)",
44        "trait_color": "rgb(57, 175, 215)",
45        "struct_color": "rgb(255, 160, 165)",
46        "enum_color": "rgb(255, 160, 165)",
47        "primitive_color": "rgb(255, 160, 165)",
48        "constant_color": "rgb(57, 175, 215)",
49        "fn_color": "rgb(253, 214, 135)",
50        "assoc_type_color": "rgb(57, 175, 215)",
51    },
52)
53call-function: (
54    "check-colors",
55    {
56        "theme": "dark",
57        "attr_color": "rgb(153, 153, 153)",
58        "trait_color": "rgb(183, 140, 242)",
59        "struct_color": "rgb(45, 191, 184)",
60        "enum_color": "rgb(45, 191, 184)",
61        "primitive_color": "rgb(45, 191, 184)",
62        "constant_color": "rgb(210, 153, 29)",
63        "fn_color": "rgb(43, 171, 99)",
64        "assoc_type_color": "rgb(210, 153, 29)",
65    },
66)
67call-function: (
68    "check-colors",
69    {
70        "theme": "light",
71        "attr_color": "rgb(153, 153, 153)",
72        "trait_color": "rgb(110, 79, 201)",
73        "struct_color": "rgb(173, 55, 138)",
74        "enum_color": "rgb(173, 55, 138)",
75        "primitive_color": "rgb(173, 55, 138)",
76        "constant_color": "rgb(56, 115, 173)",
77        "fn_color": "rgb(173, 124, 55)",
78        "assoc_type_color": "rgb(56, 115, 173)",
79    },
80)
81