Skip to content

Commit 53c5a69

Browse files
Move check-container-color's code into check-search-color function
1 parent 2b1c799 commit 53c5a69

File tree

1 file changed

+19
-31
lines changed

1 file changed

+19
-31
lines changed

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

+19-31
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,25 @@ define-function: (
8181
"hover_color": |fn_color|,
8282
})
8383

84-
call-function: ("check-container-color", {
85-
"path_color": |path_color|,
86-
"hover_path_color": |hover_path_color|,
87-
"hover_background": |hover_background|,
88-
})
84+
// Checking the `<a>` container.
85+
move-cursor-to: ".search-input"
86+
focus: ".search-input" // To ensure the `<a>` container isn't focused or hovered.
87+
assert-css: (
88+
"//*[@class='result-name']//*[text()='test_docs::']/ancestor::a",
89+
{"color": |path_color|, "background-color": "transparent"},
90+
ALL,
91+
)
92+
93+
// Checking color and background on hover.
94+
move-cursor-to: "//*[@class='desc'][text()='Just a normal struct.']"
95+
assert-css: (
96+
"//*[@class='result-name']//*[text()='test_docs::']",
97+
{"color": |hover_path_color|},
98+
)
99+
assert-css: (
100+
"//*[@class='result-name']//*[text()='test_docs::']/ancestor::a",
101+
{"color": |hover_path_color|, "background-color": |hover_background|},
102+
)
89103
}
90104
)
91105

@@ -126,32 +140,6 @@ define-function: (
126140
},
127141
)
128142

129-
define-function: (
130-
"check-container-color",
131-
[path_color, hover_path_color, hover_background],
132-
block {
133-
// Checking the `<a>` container.
134-
move-cursor-to: ".search-input"
135-
focus: ".search-input" // To ensure the `<a>` container isn't focused or hovered.
136-
assert-css: (
137-
"//*[@class='result-name']//*[text()='test_docs::']/ancestor::a",
138-
{"color": |path_color|, "background-color": "transparent"},
139-
ALL,
140-
)
141-
142-
// Checking color and background on hover.
143-
move-cursor-to: "//*[@class='desc'][text()='Just a normal struct.']"
144-
assert-css: (
145-
"//*[@class='result-name']//*[text()='test_docs::']",
146-
{"color": |hover_path_color|},
147-
)
148-
assert-css: (
149-
"//*[@class='result-name']//*[text()='test_docs::']/ancestor::a",
150-
{"color": |hover_path_color|, "background-color": |hover_background|},
151-
)
152-
}
153-
)
154-
155143
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=coo"
156144

157145
// This is needed so that the text color is computed.

0 commit comments

Comments
 (0)