summaryrefslogtreecommitdiffstats
path: root/src/test/rustdoc-gui/search-result-color.goml
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/rustdoc-gui/search-result-color.goml')
-rw-r--r--src/test/rustdoc-gui/search-result-color.goml79
1 files changed, 58 insertions, 21 deletions
diff --git a/src/test/rustdoc-gui/search-result-color.goml b/src/test/rustdoc-gui/search-result-color.goml
index 69bb30df9..dde43b1c9 100644
--- a/src/test/rustdoc-gui/search-result-color.goml
+++ b/src/test/rustdoc-gui/search-result-color.goml
@@ -67,7 +67,7 @@ reload:
// Waiting for the search results to appear...
wait-for: "#titles"
assert-css: (
- "//*[@class='desc']//*[text()='Just a normal struct.']",
+ "//*[@class='desc'][text()='Just a normal struct.']",
{"color": "rgb(197, 197, 197)"},
)
assert-css: (
@@ -75,6 +75,12 @@ assert-css: (
{"color": "rgb(0, 150, 207)"},
)
+// Checking the color of the bottom border.
+assert-css: (
+ ".search-results > a",
+ {"border-bottom-color": "rgba(170, 170, 170, 0.2)"}
+)
+
// Checking the color of "keyword" text.
assert-css: (
"//*[@class='result-name']//*[text()='(keyword)']",
@@ -153,7 +159,7 @@ assert-css: (
)
// Checking color and background on hover.
-move-cursor-to: "//*[@class='desc']//*[text()='Just a normal struct.']"
+move-cursor-to: "//*[@class='desc'][text()='Just a normal struct.']"
assert-css: (
"//*[@class='result-name']/*[text()='test_docs::']",
{"color": "rgb(255, 255, 255)"},
@@ -173,7 +179,7 @@ reload:
// Waiting for the search results to appear...
wait-for: "#titles"
assert-css: (
- "//*[@class='desc']//*[text()='Just a normal struct.']",
+ "//*[@class='desc'][text()='Just a normal struct.']",
{"color": "rgb(221, 221, 221)"},
)
assert-css: (
@@ -181,6 +187,12 @@ assert-css: (
{"color": "rgb(221, 221, 221)"},
)
+// Checking the color of the bottom border.
+assert-css: (
+ ".search-results > a",
+ {"border-bottom-color": "rgba(170, 170, 170, 0.2)"}
+)
+
// Checking the color for "keyword" text.
assert-css: (
"//*[@class='result-name']//*[text()='(keyword)']",
@@ -264,7 +276,7 @@ reload:
// Waiting for the search results to appear...
wait-for: "#titles"
assert-css: (
- "//*[@class='desc']//*[text()='Just a normal struct.']",
+ "//*[@class='desc'][text()='Just a normal struct.']",
{"color": "rgb(0, 0, 0)"},
)
assert-css: (
@@ -272,6 +284,12 @@ assert-css: (
{"color": "rgb(0, 0, 0)"},
)
+// Checking the color of the bottom border.
+assert-css: (
+ ".search-results > a",
+ {"border-bottom-color": "rgba(170, 170, 170, 0.2)"}
+)
+
// Checking the color for "keyword" text.
assert-css: (
"//*[@class='result-name']//*[text()='(keyword)']",
@@ -348,23 +366,42 @@ assert-css: (
{"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
)
-// Check the alias more specifically in the dark theme.
+// Check the alias.
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
-// We set the theme so we're sure that the correct values will be used, whatever the computer
-// this test is running on.
-local-storage: {
- "rustdoc-theme": "dark",
- "rustdoc-use-system-theme": "false",
-}
// If the text isn't displayed, the browser doesn't compute color style correctly...
show-text: true
-// We reload the page so the local storage settings are being used.
-reload:
-write: (".search-input", "thisisanalias")
-// To be SURE that the search will be run.
-press-key: 'Enter'
-// Waiting for the search results to appear...
-wait-for: "#titles"
-// Checking that the colors for the alias element are the ones expected.
-assert-css: (".result-name > .alias", {"color": "rgb(255, 255, 255)"})
-assert-css: (".result-name > .alias > .grey", {"color": "rgb(204, 204, 204)"})
+
+define-function: (
+ "check-alias",
+ (theme, alias, grey),
+ [
+ ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
+ ("reload"),
+ ("write", (".search-input", "thisisanalias")),
+ // To be SURE that the search will be run.
+ ("press-key", 'Enter'),
+ // Waiting for the search results to appear...
+ ("wait-for", "#titles"),
+ // Checking that the colors for the alias element are the ones expected.
+ ("assert-css", (".result-name > .alias", {"color": |alias|})),
+ ("assert-css", (".result-name > .alias > .grey", {"color": |grey|})),
+ // Leave the search results to prevent reloading with an already filled search input.
+ ("press-key", "Escape"),
+ ],
+)
+
+call-function: ("check-alias", {
+ "theme": "ayu",
+ "alias": "rgb(197, 197, 197)",
+ "grey": "rgb(153, 153, 153)",
+})
+call-function: ("check-alias", {
+ "theme": "dark",
+ "alias": "rgb(255, 255, 255)",
+ "grey": "rgb(204, 204, 204)",
+})
+call-function: ("check-alias", {
+ "theme": "light",
+ "alias": "rgb(0, 0, 0)",
+ "grey": "rgb(153, 153, 153)",
+})