Module: Capybara::ActiveAdmin::Finders::Layout
- Defined in:
- lib/capybara/active_admin/finders/layout.rb
Overview
Finders for common Active Admin components.
Instance Method Summary collapse
-
#find_action_item(title, exact: true) ⇒ Capybara::Node::Element
The found action item element.
- #find_footer(options = {}) ⇒ Object
- #within_action_item_dropdown { ... } ⇒ Object
- #within_modal_dialog ⇒ Object
- #within_panel(title, exact: nil) ⇒ Object
- #within_sidebar(title, exact: nil) ⇒ Object
- #within_tab_body ⇒ Object
Instance Method Details
#find_action_item(title, exact: true) ⇒ Capybara::Node::Element
Returns the found action item element.
40 41 42 43 |
# File 'lib/capybara/active_admin/finders/layout.rb', line 40 def find_action_item(title, exact: true) opts = exact ? { exact_text: title } : { text: title } page.find(action_item_selector, **opts) end |
#find_footer(options = {}) ⇒ Object
8 9 10 11 |
# File 'lib/capybara/active_admin/finders/layout.rb', line 8 def ( = {}) selector = have_selector(selector, **) end |
#within_action_item_dropdown { ... } ⇒ Object
46 47 48 |
# File 'lib/capybara/active_admin/finders/layout.rb', line 46 def within_action_item_dropdown within("#{action_item_selector} .dropdown_menu_list_wrapper") { yield } end |
#within_modal_dialog ⇒ Object
33 34 35 |
# File 'lib/capybara/active_admin/finders/layout.rb', line 33 def within_modal_dialog within(modal_dialog_selector) { yield } end |
#within_panel(title, exact: nil) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/capybara/active_admin/finders/layout.rb', line 24 def within_panel(title, exact: nil) title_selector = "#{panel_selector} > #{panel_title_selector}" title_opts = Util.(title, exact: exact) panel_title = find(title_selector, **title_opts) panel_content = panel_title.sibling(panel_content_selector) within(panel_content) { yield } end |
#within_sidebar(title, exact: nil) ⇒ Object
18 19 20 21 22 |
# File 'lib/capybara/active_admin/finders/layout.rb', line 18 def (title, exact: nil) opts = Util.(title, exact: exact) = page.find("#{sidebar_selector} .sidebar_section #{panel_title_selector}", **opts).ancestor('.sidebar_section') within() { yield } end |
#within_tab_body ⇒ Object
13 14 15 16 |
# File 'lib/capybara/active_admin/finders/layout.rb', line 13 def within_tab_body selector = tab_content_selector within(selector) { yield } end |