summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-gui/links-color.goml
blob: 14f7d99351a646364d9ba5cdf9e58324fc6cd940 (plain)
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
// This test checks links colors.
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"

// This is needed so that the text color is computed.
show-text: true

define-function: (
    "check-colors",
    (theme, mod, macro, struct, enum, trait, fn, type, union, keyword,
     sidebar, sidebar_current, sidebar_current_background),
    block {
        local-storage: {
            "rustdoc-theme": |theme|,
            "rustdoc-use-system-theme": "false",
        }
        reload:
        // Checking results colors.
        assert-css: (".item-table .mod", {"color": |mod|}, ALL)
        assert-css: (".item-table .macro", {"color": |macro|}, ALL)
        assert-css: (".item-table .struct", {"color": |struct|}, ALL)
        assert-css: (".item-table .enum", {"color": |enum|}, ALL)
        assert-css: (".item-table .trait", {"color": |trait|}, ALL)
        assert-css: (".item-table .fn", {"color": |fn|}, ALL)
        assert-css: (".item-table .type", {"color": |type|}, ALL)
        assert-css: (".item-table .union", {"color": |union|}, ALL)
        assert-css: (".item-table .keyword", {"color": |keyword|}, ALL)
        // Checking sidebar elements.
        assert-css: (
            ".sidebar-elems a:not(.current)",
            {"color": |sidebar|, "background-color": "rgba(0, 0, 0, 0)", "font-weight": "400"},
            ALL,
        )
        assert-css: (
            ".sidebar-elems a.current",
            {
                "color": |sidebar_current|,
                "background-color": |sidebar_current_background|,
                "font-weight": "500",
            },
            ALL,
        )
    },
)

call-function: (
    "check-colors",
    {
        "theme": "ayu",
        "mod": "rgb(57, 175, 215)",
        "macro": "rgb(163, 122, 204)",
        "struct": "rgb(255, 160, 165)",
        "enum": "rgb(255, 160, 165)",
        "trait": "rgb(57, 175, 215)",
        "fn": "rgb(253, 214, 135)",
        "type": "rgb(255, 160, 165)",
        "union": "rgb(255, 160, 165)",
        "keyword": "rgb(57, 175, 215)",
        "sidebar": "rgb(83, 177, 219)",
        "sidebar_current": "rgb(255, 180, 76)",
        "sidebar_current_background": "rgba(0, 0, 0, 0)",
    },
)
call-function: (
    "check-colors",
    {
        "theme": "dark",
        "mod": "rgb(210, 153, 29)",
        "macro": "rgb(9, 189, 0)",
        "struct": "rgb(45, 191, 184)",
        "enum": "rgb(45, 191, 184)",
        "trait": "rgb(183, 140, 242)",
        "fn": "rgb(43, 171, 99)",
        "type": "rgb(45, 191, 184)",
        "union": "rgb(45, 191, 184)",
        "keyword": "rgb(210, 153, 29)",
        "sidebar": "rgb(253, 191, 53)",
        "sidebar_current": "rgb(253, 191, 53)",
        "sidebar_current_background": "rgb(68, 68, 68)",
    },
)
call-function: (
    "check-colors",
    {
        "theme": "light",
        "mod": "rgb(56, 115, 173)",
        "macro": "rgb(6, 128, 0)",
        "struct": "rgb(173, 55, 138)",
        "enum": "rgb(173, 55, 138)",
        "trait": "rgb(110, 79, 201)",
        "fn": "rgb(173, 124, 55)",
        "type": "rgb(173, 55, 138)",
        "union": "rgb(173, 55, 138)",
        "keyword": "rgb(56, 115, 173)",
        "sidebar": "rgb(53, 109, 164)",
        "sidebar_current": "rgb(53, 109, 164)",
        "sidebar_current_background": "rgb(255, 255, 255)",
    },
)