summaryrefslogtreecommitdiffstats
path: root/src/test/rustdoc-gui/anchors.goml
blob: 3ad62c721b4b83768cb40efbc6fbdddb037855d3 (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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
// This test is to ensure that the anchors (`§`) have the expected color and position.
goto: file://|DOC_PATH|/staged_api/struct.Foo.html

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

// Set the theme to light.
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
// We reload the page so the local storage settings are being used.
reload:

assert-css: ("#toggle-all-docs", {"color": "rgb(0, 0, 0)"})
assert-css: (".fqn .in-band a:nth-of-type(1)", {"color": "rgb(0, 0, 0)"})
assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgb(173, 55, 138)"})
assert-css: (
    ".rightside .srclink",
    {"color": "rgb(56, 115, 173)", "text-decoration": "none solid rgb(56, 115, 173)"},
    ALL,
)
compare-elements-css: (".rightside .srclink", ".rightside.srclink", ["color", "text-decoration"])
compare-elements-css: (".main-heading .srclink", ".rightside.srclink", ["color", "text-decoration"])

move-cursor-to: ".main-heading .srclink"
assert-css: (
    ".main-heading .srclink",
    {"color": "rgb(56, 115, 173)", "text-decoration": "underline solid rgb(56, 115, 173)"},
)
move-cursor-to: ".impl-items .rightside .srclink"
assert-css: (
    ".impl-items .rightside .srclink",
    {"color": "rgb(56, 115, 173)", "text-decoration": "none solid rgb(56, 115, 173)"},
)
move-cursor-to: ".impl-items .rightside.srclink"
assert-css: (
    ".impl-items .rightside.srclink",
    {"color": "rgb(56, 115, 173)", "text-decoration": "none solid rgb(56, 115, 173)"},
)

goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html

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

assert-css: (".sidebar a", {"color": "rgb(53, 109, 164)"})
assert-css: (".in-band a", {"color": "rgb(0, 0, 0)"})

// 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": "rgb(0, 0, 0)"})

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

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

//
// We do the same checks with the dark theme now.
//
local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
goto: file://|DOC_PATH|/staged_api/struct.Foo.html

assert-css: ("#toggle-all-docs", {"color": "rgb(221, 221, 221)"})
assert-css: (".fqn .in-band a:nth-of-type(1)", {"color": "rgb(221, 221, 221)"})
assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgb(45, 191, 184)"})
assert-css: (
    ".rightside .srclink",
    {"color": "rgb(210, 153, 29)", "text-decoration": "none solid rgb(210, 153, 29)"},
    ALL,
)
compare-elements-css: (".rightside .srclink", ".rightside.srclink", ["color", "text-decoration"])
compare-elements-css: (".main-heading .srclink", ".rightside.srclink", ["color", "text-decoration"])

move-cursor-to: ".main-heading .srclink"
assert-css: (
    ".main-heading .srclink",
    {"color": "rgb(210, 153, 29)", "text-decoration": "underline solid rgb(210, 153, 29)"},
)
move-cursor-to: ".impl-items .rightside .srclink"
assert-css: (
    ".impl-items .rightside .srclink",
    {"color": "rgb(210, 153, 29)", "text-decoration": "none solid rgb(210, 153, 29)"},
)
move-cursor-to: ".impl-items .rightside.srclink"
assert-css: (
    ".impl-items .rightside.srclink",
    {"color": "rgb(210, 153, 29)", "text-decoration": "none solid rgb(210, 153, 29)"},
)

goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html

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

assert-css: (".sidebar a", {"color": "rgb(253, 191, 53)"})
assert-css: (".in-band a", {"color": "rgb(221, 221, 221)"})

// 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": "rgb(221, 221, 221)"})

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

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

//
// We do the same checks with the ayu theme now.
//
local-storage: {"rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false"}
goto: file://|DOC_PATH|/staged_api/struct.Foo.html

assert-css: ("#toggle-all-docs", {"color": "rgb(197, 197, 197)"})
assert-css: (".fqn .in-band a:nth-of-type(1)", {"color": "rgb(255, 255, 255)"})
assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgb(255, 160, 165)"})
assert-css: (
    ".rightside .srclink",
    {"color": "rgb(57, 175, 215)", "text-decoration": "none solid rgb(57, 175, 215)"},
    ALL,
)
compare-elements-css: (".rightside .srclink", ".rightside.srclink", ["color", "text-decoration"])
compare-elements-css: (".main-heading .srclink", ".rightside.srclink", ["color", "text-decoration"])

move-cursor-to: ".main-heading .srclink"
assert-css: (
    ".main-heading .srclink",
    {"color": "rgb(57, 175, 215)", "text-decoration": "underline solid rgb(57, 175, 215)"},
)
move-cursor-to: ".impl-items .rightside .srclink"
assert-css: (
    ".impl-items .rightside .srclink",
    {"color": "rgb(57, 175, 215)", "text-decoration": "none solid rgb(57, 175, 215)"},
)
move-cursor-to: ".impl-items .rightside.srclink"
assert-css: (
    ".impl-items .rightside.srclink",
    {"color": "rgb(57, 175, 215)", "text-decoration": "none solid rgb(57, 175, 215)"},
)

goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html

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

assert-css: (".sidebar a", {"color": "rgb(83, 177, 219)"})
assert-css: (".in-band a", {"color": "rgb(255, 255, 255)"})

// 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": "rgb(197, 197, 197)"})

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

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