Skip to content

Commit 2dd00d3

Browse files
committed
fix rustdoc tests broke by trait item filtering
1 parent c407d34 commit 2dd00d3

File tree

6 files changed

+42
-35
lines changed

6 files changed

+42
-35
lines changed

tests/rustdoc-gui/search-result-color.goml

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ include: "utils.goml"
55
define-function: (
66
"check-search-color",
77
[
8-
theme, count_color, desc_color, path_color, bottom_border_color, keyword_color,
8+
theme, count_color, path_color, bottom_border_color, keyword_color,
99
struct_color, associatedtype_color, tymethod_color, method_color, structfield_color,
1010
structfield_hover_color, macro_color, fn_color, hover_path_color, hover_background,
1111
attribute_color, grey
@@ -21,10 +21,6 @@ define-function: (
2121
{"color": |count_color|},
2222
ALL,
2323
)
24-
assert-css: (
25-
"//*[@class='desc'][normalize-space()='Just a normal struct.']",
26-
{"color": |desc_color|},
27-
)
2824
assert-css: (
2925
"//*[@class='result-name']//*[normalize-space()='test_docs::']",
3026
{"color": |path_color|},
@@ -97,16 +93,6 @@ define-function: (
9793
ALL,
9894
)
9995

100-
// Checking color and background on hover.
101-
move-cursor-to: "//*[@class='desc'][normalize-space()='Just a normal struct.']"
102-
assert-css: (
103-
"//*[@class='result-name']//*[normalize-space()='test_docs::']",
104-
{"color": |hover_path_color|},
105-
)
106-
assert-css: (
107-
"//*[@class='result-name']//*[normalize-space()='test_docs::']/ancestor::a",
108-
{"color": |hover_path_color|, "background-color": |hover_background|},
109-
)
11096
}
11197
)
11298

@@ -157,7 +143,6 @@ show-text: true
157143
call-function: ("check-search-color", {
158144
"theme": "ayu",
159145
"count_color": "#888",
160-
"desc_color": "#c5c5c5",
161146
"path_color": "#0096cf",
162147
"bottom_border_color": "#aaa3",
163148
"keyword_color": "#39afd7",
@@ -179,7 +164,6 @@ call-function: ("check-search-color", {
179164
call-function: ("check-search-color", {
180165
"theme": "dark",
181166
"count_color": "#888",
182-
"desc_color": "#ddd",
183167
"path_color": "#ddd",
184168
"bottom_border_color": "#aaa3",
185169
"keyword_color": "#d2991d",
@@ -201,7 +185,6 @@ call-function: ("check-search-color", {
201185
call-function: ("check-search-color", {
202186
"theme": "light",
203187
"count_color": "#888",
204-
"desc_color": "#000",
205188
"path_color": "#000",
206189
"bottom_border_color": "#aaa3",
207190
"keyword_color": "#3873ad",
@@ -226,27 +209,51 @@ call-function: ("perform-search", {"query": "thisisanalias"})
226209

227210
define-function: (
228211
"check-alias",
229-
[theme, alias, grey],
212+
[theme, alias, grey, desc_color, hover_path_color, hover_background],
230213
block {
231214
call-function: ("switch-theme", {"theme": |theme|})
232215
// Checking that the colors for the alias element are the ones expected.
233216
assert-css: (".result-name .path .alias", {"color": |alias|})
234217
assert-css: (".result-name .path .alias > .grey", {"color": |grey|})
218+
assert-css: (
219+
"//*[@class='desc'][normalize-space()='Just a normal enum.']",
220+
{"color": |desc_color|},
221+
)
222+
// Checking color and background on hover.
223+
move-cursor-to: "//*[@class='desc'][normalize-space()='Just a normal enum.']"
224+
assert-css: (
225+
"//*[@class='result-name']//*[normalize-space()='test_docs::']",
226+
{"color": |hover_path_color|},
227+
)
228+
assert-css: (
229+
"//*[@class='result-name']//*[normalize-space()='test_docs::']/ancestor::a",
230+
{"color": |hover_path_color|, "background-color": |hover_background|},
231+
)
232+
235233
},
236234
)
237235

238236
call-function: ("check-alias", {
239237
"theme": "ayu",
240238
"alias": "#c5c5c5",
241239
"grey": "#999",
240+
"desc_color": "#c5c5c5",
241+
"hover_path_color": "#fff",
242+
"hover_background": "#3c3c3c",
242243
})
243244
call-function: ("check-alias", {
244245
"theme": "dark",
245246
"alias": "#fff",
246247
"grey": "#ccc",
248+
"desc_color": "#ddd",
249+
"hover_path_color": "#ddd",
250+
"hover_background": "#616161",
247251
})
248252
call-function: ("check-alias", {
249253
"theme": "light",
250254
"alias": "#000",
251255
"grey": "#999",
256+
"desc_color": "#000",
257+
"hover_path_color": "#000",
258+
"hover_background": "#ccc",
252259
})

tests/rustdoc-gui/search-tab.goml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ call-function: ("check-colors", {
7979
set-window-size: (851, 600)
8080

8181
// Check the size and count in tabs
82-
assert-text: ("#search-tabs > button:nth-child(1) > .count", " (27) ")
82+
assert-text: ("#search-tabs > button:nth-child(1) > .count", " (25) ")
8383
assert-text: ("#search-tabs > button:nth-child(2) > .count", " (7)  ")
8484
assert-text: ("#search-tabs > button:nth-child(3) > .count", " (0)  ")
8585
store-property: ("#search-tabs > button:nth-child(1)", {"offsetWidth": buttonWidth})

tests/rustdoc-gui/sidebar.goml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Checks multiple things on the sidebar display (width of its elements, colors, etc).
22
include: "utils.goml"
3+
// Disable animations so they don't mess up color assertions later.
4+
emulate-media-features: { "prefers-reduced-motion": "reduce" }
35
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
46
assert-property: (".sidebar", {"clientWidth": "199"})
57
show-text: true

tests/rustdoc-js-std/asrawfd.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
// ignore-order
22

33
const EXPECTED = {
4-
'query': 'RawFd::as_raw_fd',
4+
'query': 'method:RawFd::as_raw_fd',
55
'others': [
66
// Reproduction test for https://github.com/rust-lang/rust/issues/78724
77
// Validate that type alias methods get the correct path.
8-
{ 'path': 'std::os::fd::AsRawFd', 'name': 'as_raw_fd' },
9-
{ 'path': 'std::os::fd::AsRawFd', 'name': 'as_raw_fd' },
108
{ 'path': 'std::os::fd::RawFd', 'name': 'as_raw_fd' },
119
],
1210
};

tests/rustdoc-js-std/quoted.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1+
// make sure quoted search works both for items and and without generics
12
// ignore-order
23

34
const FILTER_CRATE = 'std';
45

56
const EXPECTED = {
6-
'query': '"error"',
7+
'query': '"result"',
78
'others': [
8-
{ 'path': 'std', 'name': 'error' },
9-
{ 'path': 'std::fmt', 'name': 'Error' },
10-
{ 'path': 'std::io', 'name': 'Error' },
9+
{ 'path': 'std', 'name': 'result' },
10+
{ 'path': 'std::result', 'name': 'Result' },
11+
{ 'path': 'std::fmt', 'name': 'Result' },
1112
],
1213
'in_args': [
13-
{ 'path': 'std::fmt::Error', 'name': 'eq' },
14-
{ 'path': 'std::fmt::Error', 'name': 'cmp' },
15-
{ 'path': 'std::fmt::Error', 'name': 'partial_cmp' },
16-
14+
{ 'path': 'std::result::Result', 'name': 'branch' },
15+
{ 'path': 'std::result::Result', 'name': 'ok' },
16+
{ 'path': 'std::result::Result', 'name': 'unwrap' },
1717
],
1818
'returned': [
19-
{ 'path': 'std::fmt::LowerExp', 'name': 'fmt' },
19+
{ 'path': 'std::bool', 'name': 'try_into' },
2020
],
2121
};

tests/rustdoc-js-std/bufread-fill-buf.js renamed to tests/rustdoc-js-std/trait-unbox.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
// ignore-order
1+
// make sure type-based searches with traits get unboxed too
22

33
const EXPECTED = [
44
{
5-
'query': 'bufread -> result<[u8]>',
5+
'query': 'any -> result<box>',
66
'others': [
7-
{ 'path': 'std::boxed::Box', 'name': 'fill_buf' },
7+
{ 'path': 'std::boxed::Box', 'name': 'downcast' },
88
],
99
},
1010
{

0 commit comments

Comments
 (0)