module Capybara::Compose::Actions

Internal: Wraps Capybara actions to enable locator aliases, and to wrap the result with a test helper so that methods can be chained in a fluent style.

Public Instance Methods

blur() click to toggle source

Public: Useful to natively blur an element.

# File lib/capybara/compose/actions.rb, line 112
def blur
  to_capybara_node.execute_script('this.blur()')
  self
end
focus() click to toggle source

Public: Useful to natively give focus to an element.

# File lib/capybara/compose/actions.rb, line 106
def focus
  to_capybara_node.execute_script('this.focus()')
  self
end
type_in(*text, typing: text.size > 1 || text.first.is_a?(Symbol) || text.first.is_a?(Array), **options) click to toggle source

Public: Sets the value for the input, or presses the specified keys, one at a time.

# File lib/capybara/compose/actions.rb, line 101
def type_in(*text, typing: text.size > 1 || text.first.is_a?(Symbol) || text.first.is_a?(Array), **options)
  typing ? send_keys(*text) : set(text.first, **options)
end