lib/capybara/node/actions.rb in capybara-2.4.4 vs lib/capybara/node/actions.rb in capybara-2.5.0
- old
+ new
@@ -14,27 +14,29 @@
end
alias_method :click_on, :click_link_or_button
##
#
- # Finds a link by id or text and clicks it. Also looks at image
+ # Finds a link by id, text or title and clicks it. Also looks at image
# alt text inside the link.
#
- # @param [String] locator Text or id of link
- # @param options
- # @option options [String] :href The value the href attribute must be
+ # @param [String] locator text, id, title or nested image's alt attribute
+ # @param options See {Capybara::Node::Finders#find_link}
#
def click_link(locator, options={})
find(:link, locator, options).click
end
##
#
- # Finds a button by id, text or value and clicks it.
+ # Finds a button on the page and clicks it.
+ # This can be any \<input> element of type submit, reset, image, button or it can be a
+ # \<button> element. All buttons can be found by their id, value, or title. \<button> elements can also be found
+ # by their text content, and image \<input> elements by their alt attribute
#
- # @param [String] locator Text, id or value of button
- #
+ # @param [String] locator Which button to find
+ # @param options See {Capybara::Node::Finders#find_button}
def click_button(locator, options={})
find(:button, locator, options).click
end
##
@@ -95,17 +97,20 @@
find(:checkbox, locator, options).set(false)
end
##
#
- # Find a select box on the page and select a particular option from it. If the select
- # box is a multiple select, +select+ can be called multiple times to select more than
- # one option. The select box can be found via its name, id or label text.
+ # If `:from` option is present, `select` finds a select box on the page
+ # and selects a particular option from it.
+ # Otherwise it finds an option inside current scope and selects it.
+ # If the select box is a multiple select, +select+ can be called multiple times to select more than
+ # one option.
+ # The select box can be found via its name, id or label text. The option can be found by its text.
#
# page.select 'March', :from => 'Month'
#
# @param [String] value Which option to select
- # @param [Hash{:from => String}] options The id, name or label of the select box
+ # @option options [String] :from The id, name or label of the select box
#
def select(value, options={})
if options.has_key?(:from)
from = options.delete(:from)
find(:select, from, options).find(:option, value, options).select_option