mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Move more common code into a function in tests/rustdoc-gui/search-result-color.goml
This commit is contained in:
parent
4967895e55
commit
f14e4db1f9
@ -69,6 +69,32 @@ define-function: (
|
||||
},
|
||||
)
|
||||
|
||||
define-function: (
|
||||
"check-container-color",
|
||||
[link_color, path_color, hover_background],
|
||||
block {
|
||||
// Checking the `<a>` container.
|
||||
move-cursor-to: ".search-input"
|
||||
focus: ".search-input" // To ensure the `<a>` container isn't focused or hovered.
|
||||
assert-css: (
|
||||
"//*[@class='result-name']//*[text()='test_docs::']/ancestor::a",
|
||||
{"color": |link_color|, "background-color": "transparent"},
|
||||
ALL,
|
||||
)
|
||||
|
||||
// Checking color and background on hover.
|
||||
move-cursor-to: "//*[@class='desc'][text()='Just a normal struct.']"
|
||||
assert-css: (
|
||||
"//*[@class='result-name']//*[text()='test_docs::']",
|
||||
{"color": |path_color|},
|
||||
)
|
||||
assert-css: (
|
||||
"//*[@class='result-name']//*[text()='test_docs::']/ancestor::a",
|
||||
{"color": |path_color|, "background-color": |hover_background|},
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=coo"
|
||||
|
||||
// This is needed so that the text color is computed.
|
||||
@ -146,24 +172,12 @@ call-function: (
|
||||
},
|
||||
)
|
||||
|
||||
// Checking the `<a>` container.
|
||||
move-cursor-to: ".search-input"
|
||||
focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
|
||||
assert-css: (
|
||||
"//*[@class='result-name']//*[text()='test_docs::']/ancestor::a",
|
||||
{"color": "#0096cf", "background-color": "transparent"},
|
||||
ALL,
|
||||
)
|
||||
|
||||
// Checking color and background on hover.
|
||||
move-cursor-to: "//*[@class='desc'][text()='Just a normal struct.']"
|
||||
assert-css: (
|
||||
"//*[@class='result-name']//*[text()='test_docs::']",
|
||||
{"color": "#fff"},
|
||||
)
|
||||
assert-css: (
|
||||
"//*[@class='result-name']//*[text()='test_docs::']/ancestor::a",
|
||||
{"color": "#fff", "background-color": "#3c3c3c"},
|
||||
call-function: (
|
||||
"check-container-color", {
|
||||
"link_color": "#0096cf",
|
||||
"path_color": "#fff",
|
||||
"hover_background": "#3c3c3c",
|
||||
},
|
||||
)
|
||||
|
||||
// Dark theme
|
||||
@ -238,12 +252,12 @@ call-function: (
|
||||
},
|
||||
)
|
||||
|
||||
// Checking the `<a>` container.
|
||||
move-cursor-to: ".search-input"
|
||||
focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
|
||||
assert-css: (
|
||||
"//*[@class='result-name']//*[text()='test_docs::']/ancestor::a",
|
||||
{"color": "#ddd", "background-color": "transparent"},
|
||||
call-function: (
|
||||
"check-container-color", {
|
||||
"link_color": "#ddd",
|
||||
"path_color": "#ddd",
|
||||
"hover_background": "#616161",
|
||||
},
|
||||
)
|
||||
|
||||
// Light theme
|
||||
@ -318,12 +332,12 @@ call-function: (
|
||||
},
|
||||
)
|
||||
|
||||
// Checking the `<a>` container.
|
||||
move-cursor-to: ".search-input"
|
||||
focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
|
||||
assert-css: (
|
||||
"//*[@class='result-name']//*[text()='test_docs::']/ancestor::a",
|
||||
{"color": "#000", "background-color": "transparent"},
|
||||
call-function: (
|
||||
"check-container-color", {
|
||||
"link_color": "#000",
|
||||
"path_color": "#000",
|
||||
"hover_background": "#ccc",
|
||||
},
|
||||
)
|
||||
|
||||
// Check the alias.
|
||||
|
Loading…
Reference in New Issue
Block a user