fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
2.2 KiB70 linesraw
1// This test check for headers text and background colors for the different themes.
2
3define-function: (
4    "check-colors",
5    (theme, color, code_header_color, focus_background_color, headings_color),
6    block {
7        go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
8        // This is needed so that the text color is computed.
9        show-text: true
10        set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
11        reload:
12        assert-css: (
13            ".impl",
14            {"color": |color|, "background-color": "rgba(0, 0, 0, 0)"},
15            ALL,
16        )
17        assert-css: (
18            ".impl .code-header",
19            {"color": |code_header_color|, "background-color": "rgba(0, 0, 0, 0)"},
20            ALL,
21        )
22        go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo"
23        assert-css: (
24            "#impl-Foo",
25            {"color": |color|, "background-color": |focus_background_color|},
26        )
27        go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use"
28        assert-css: (
29            "#method\.must_use",
30            {"color": |color|, "background-color": |focus_background_color|},
31            ALL,
32        )
33        go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
34        assert-css: (".small-section-header a", {"color": |color|}, ALL)
35        go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
36        // We select headings (h2, h3, h...).
37        assert-css: (".docblock > :not(p) > a", {"color": |headings_color|}, ALL)
38    },
39)
40
41call-function: (
42    "check-colors",
43    {
44        "theme": "ayu",
45        "color": "#c5c5c5",
46        "code_header_color": "#e6e1cf",
47        "focus_background_color": "rgba(255, 236, 164, 0.06)",
48        "headings_color": "#39afd7",
49    },
50)
51call-function: (
52    "check-colors",
53    {
54        "theme": "dark",
55        "color": "#ddd",
56        "code_header_color": "#ddd",
57        "focus_background_color": "#494a3d",
58        "headings_color": "#d2991d",
59    },
60)
61call-function: (
62    "check-colors",
63    {
64        "theme": "light",
65        "color": "black",
66        "code_header_color": "black",
67        "focus_background_color": "#fdffd3",
68        "headings_color": "#3873ad",
69    },
70)