The personal finance app for everyone (by everyone)
Ruby
Match combobox hover assertions to browser capabilities
Juan José Mata03c1d4686f2b
diff --git a/test/system/combobox_dark_theme_test.rb b/test/system/combobox_dark_theme_test.rbindex d8b4a97fbd..d201ee19da 100644--- a/test/system/combobox_dark_theme_test.rb+++ b/test/system/combobox_dark_theme_test.rb@@ -40,8 +40,7 @@ class ComboboxDarkThemeTest < ApplicationSystemTestCaseassert_hover_uses_theme_colors(dialog)end- # Above the breakpoint the results open in an inline dropdown, whose hovered- # result reads the same gem variable.+ # Above the breakpoint the results open in an inline dropdown.test "desktop security dropdown uses theme colors in the dark theme" dovisit new_trade_path(account_id: accounts(:investment).id)assert_selector "html[data-theme='dark']"@@ -62,7 +61,11 @@ class ComboboxDarkThemeTest < ApplicationSystemTestCaseoption.call("Microsoft")option.call("Apple").hover- assert_equal token_color("--color-container-inset-hover"), computed(option.call("Apple"), "backgroundColor")+ # Tailwind's hover rule applies only when the browser reports hover support.+ supports_hover = page.evaluate_script("matchMedia('(hover: hover)').matches")+ hover_token = supports_hover ? "--color-container-hover" : "--color-container-inset-hover"++ assert_equal token_color(hover_token), computed(option.call("Apple"), "backgroundColor")assert_equal element_style("text-primary", "color"), computed(option.call("Apple"), "color")assert_equal token_color("--color-container"), computed(option.call("Microsoft"), "backgroundColor")end