mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-02 09:31:40 +08:00
Now we have the search input showing in a few different configurations: * Welcome banner * Header field * Header icon And we can get to the search with both `/` and `Ctrl+F` shortcuts. These configurations can be used together, and we need to focus on the right search input at the right time. This commit fixes the shortcuts not working or showing the wrong thing in some cases, and adds a comprehensive system spec for all the variants.
25 lines
648 B
Ruby
25 lines
648 B
Ruby
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Pages
|
|
class Header < PageObjects::Pages::Base
|
|
def get_computed_style_value(selector, property)
|
|
page.evaluate_script(
|
|
"window.getComputedStyle(document.querySelector('#{selector}')).getPropertyValue('#{property}')",
|
|
).strip
|
|
end
|
|
|
|
def resize_element(selector, size)
|
|
page.evaluate_script("document.querySelector('#{selector}').style.height = '#{size}px'")
|
|
end
|
|
|
|
def active_element_id
|
|
current_active_element[:id]
|
|
end
|
|
|
|
def click_outside
|
|
find(".d-modal").click(x: 0, y: 0)
|
|
end
|
|
end
|
|
end
|
|
end
|