File: anchors.goml

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (106 lines) | stat: -rw-r--r-- 3,757 bytes parent folder | download | duplicates (3)
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
// This test is to ensure that the anchors (`ยง`) have the expected color and position.
include: "utils.goml"

define-function: (
    "check-colors",
    [theme, main_color, title_color, main_heading_color, main_heading_type_color, src_link_color, sidebar_link_color],
    block {
        go-to: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html"
        // This is needed to ensure that the text color is computed.
        show-text: true

        call-function: ("switch-theme", {"theme": |theme|})

        assert-css: ("#toggle-all-docs", {"color": |main_color|})
        assert-css: (".main-heading h1 span", {"color": |main_heading_type_color|})
        assert-css: (
             ".rightside a.src",
             {"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|},
             ALL,
        )
        compare-elements-css: (
            ".rightside a.src",
            "a.rightside.src",
            ["color", "text-decoration"],
        )
        compare-elements-css: (
            ".main-heading a.src",
            "a.rightside.src",
            ["color", "text-decoration"],
        )

        move-cursor-to: ".main-heading a.src"
        assert-css: (
             ".main-heading a.src",
             {"color": |src_link_color|, "text-decoration": "underline solid " + |src_link_color|},
        )
        move-cursor-to: ".impl-items .rightside a.src"
        assert-css: (
             ".impl-items .rightside a.src",
             {"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|},
        )
        move-cursor-to: ".impl-items a.rightside.src"
        assert-css: (
             ".impl-items a.rightside.src",
             {"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|},
        )

        go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
        // Since we changed page, we need to set the theme again.
        set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
        // We reload the page so the local storage settings are being used.
        reload:

        assert-css: ("#top-doc-prose-title", {"color": |title_color|})

        assert-css: (".sidebar .block a", {"color": |sidebar_link_color|})
        assert-css: (".main-heading h1", {"color": |title_color|})

        // We move the cursor over the "Implementations" title so the anchor is displayed.
        move-cursor-to: "h2#implementations"
        assert-css: ("h2#implementations a.anchor", {"color": |main_color|})

        // Same thing with the impl block title.
        move-cursor-to: "#impl-HeavilyDocumentedStruct"
        assert-css: ("#impl-HeavilyDocumentedStruct a.anchor", {"color": |main_color|})

        assert-css: ("#title-for-struct-impl-item-doc", {"margin-left": "0px"})
    },
)

call-function: (
    "check-colors",
    {
        "theme": "ayu",
        "main_color": "#c5c5c5",
        "title_color": "#fff",
        "main_heading_color": "#fff",
        "main_heading_type_color": "#ffa0a5",
        "src_link_color": "#39afd7",
        "sidebar_link_color": "#53b1db",
    },
)
call-function: (
    "check-colors",
    {
        "theme": "dark",
        "main_color": "#ddd",
        "title_color": "#ddd",
        "main_heading_color": "#ddd",
        "main_heading_type_color": "#2dbfb8",
        "src_link_color": "#d2991d",
        "sidebar_link_color": "#fdbf35",
    },
)
call-function: (
    "check-colors",
    {
        "theme": "light",
        "main_color": "black",
        "title_color": "black",
        "main_heading_color": "black",
        "main_heading_type_color": "#ad378a",
        "src_link_color": "#3873ad",
        "sidebar_link_color": "#356da4",
    },
)