From 53c5a69dfdd01145fc508053adadbed17d2b315c Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 6 Apr 2024 15:52:00 +0200 Subject: [PATCH] Move `check-container-color`'s code into `check-search-color` function --- tests/rustdoc-gui/search-result-color.goml | 50 ++++++++-------------- 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/tests/rustdoc-gui/search-result-color.goml b/tests/rustdoc-gui/search-result-color.goml index 5a31afc6e61..fd0b86af3ea 100644 --- a/tests/rustdoc-gui/search-result-color.goml +++ b/tests/rustdoc-gui/search-result-color.goml @@ -81,11 +81,25 @@ define-function: ( "hover_color": |fn_color|, }) - call-function: ("check-container-color", { - "path_color": |path_color|, - "hover_path_color": |hover_path_color|, - "hover_background": |hover_background|, - }) + // Checking the `` container. + move-cursor-to: ".search-input" + focus: ".search-input" // To ensure the `` container isn't focused or hovered. + assert-css: ( + "//*[@class='result-name']//*[text()='test_docs::']/ancestor::a", + {"color": |path_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": |hover_path_color|}, + ) + assert-css: ( + "//*[@class='result-name']//*[text()='test_docs::']/ancestor::a", + {"color": |hover_path_color|, "background-color": |hover_background|}, + ) } ) @@ -126,32 +140,6 @@ define-function: ( }, ) -define-function: ( - "check-container-color", - [path_color, hover_path_color, hover_background], - block { - // Checking the `` container. - move-cursor-to: ".search-input" - focus: ".search-input" // To ensure the `` container isn't focused or hovered. - assert-css: ( - "//*[@class='result-name']//*[text()='test_docs::']/ancestor::a", - {"color": |path_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": |hover_path_color|}, - ) - assert-css: ( - "//*[@class='result-name']//*[text()='test_docs::']/ancestor::a", - {"color": |hover_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.