mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
rebase to master and cleanup parameters
This commit is contained in:
parent
9d90d6c625
commit
e7c02a2a3f
1 changed files with 11 additions and 10 deletions
|
@ -146,11 +146,11 @@ module Capybara
|
||||||
# @param [Hash] options The options of the query used to generate the description
|
# @param [Hash] options The options of the query used to generate the description
|
||||||
# @return [String] Description of the selector when used with the options passed
|
# @return [String] Description of the selector when used with the options passed
|
||||||
#
|
#
|
||||||
def description(options={})
|
def description(**options)
|
||||||
@filter_set.description(options)
|
@filter_set.description(options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def call(locator, options={})
|
def call(locator, **options)
|
||||||
if format
|
if format
|
||||||
# @expression.call(locator, options.select {|k,v| @expression_filters.include?(k)})
|
# @expression.call(locator, options.select {|k,v| @expression_filters.include?(k)})
|
||||||
@expression.call(locator, options)
|
@expression.call(locator, options)
|
||||||
|
@ -185,15 +185,11 @@ module Capybara
|
||||||
# @option options :skip_if Value of the filter that will cause it to be skipped
|
# @option options :skip_if Value of the filter that will cause it to be skipped
|
||||||
#
|
#
|
||||||
def filter(name, *types_and_options, &block)
|
def filter(name, *types_and_options, &block)
|
||||||
options = types_and_options.last.is_a?(Hash) ? types_and_options.pop.dup : {}
|
add_filter(name, Filter, *types_and_options, &block)
|
||||||
types_and_options.each { |k| options[k] = true }
|
|
||||||
custom_filters[name] = Filters::NodeFilter.new(name, block, options)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def expression_filter(name, *types_and_options, &block)
|
def expression_filter(name, *types_and_options, &block)
|
||||||
options = types_and_options.last.is_a?(Hash) ? types_and_options.pop.dup : {}
|
add_filter(name, ExpressionFilter, *types_and_options, &block)
|
||||||
types_and_options.each { |k| options[k] = true }
|
|
||||||
custom_filters[name] = Filters::ExpressionFilter.new(name, block, options)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def filter_set(name, filters_to_use = nil)
|
def filter_set(name, filters_to_use = nil)
|
||||||
|
@ -232,8 +228,13 @@ module Capybara
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def locate_field(xpath, locator, options={})
|
def add_filter(name, filter_class, *types, **options, &block)
|
||||||
locate_xpath = xpath #need to save original xpath for the label wrap
|
types.each { |k| options[k] = true}
|
||||||
|
custom_filters[name] = filter_class.new(name, block, options)
|
||||||
|
end
|
||||||
|
|
||||||
|
def locate_field(xpath, locator, **options)
|
||||||
|
locate_field = xpath #need to save original xpath for the label wrap
|
||||||
if locator
|
if locator
|
||||||
locator = locator.to_s
|
locator = locator.to_s
|
||||||
attr_matchers = XPath.attr(:id).equals(locator).or(
|
attr_matchers = XPath.attr(:id).equals(locator).or(
|
||||||
|
|
Loading…
Add table
Reference in a new issue