Sha256: b1dd666919b12a84b943ba19b4370f7a389ae17940c17356043d6828befac945
Contents?: true
Size: 901 Bytes
Versions: 10
Compression:
Stored size: 901 Bytes
Contents
# frozen_string_literal: true Capybara.add_selector(:element, locator_type: [String, Symbol]) do xpath do |locator, **| XPath.descendant.where(locator ? XPath.local_name == locator.to_s : nil) end expression_filter(:attributes, matcher: /.+/) do |xpath, name, val| builder(xpath).add_attribute_conditions(name => val) end node_filter(:attributes, matcher: /.+/) do |node, name, val| next true unless val.is_a?(Regexp) (val.match? node[name]).tap do |res| add_error("Expected #{name} to match #{val.inspect} but it was #{node[name]}") unless res end end describe_expression_filters do |**options| booleans, values = options.partition { |_k, v| [true, false].include? v }.map(&:to_h) desc = describe_all_expression_filters(**values) desc + booleans.map do |k, v| v ? " with #{k} attribute" : "without #{k} attribute" end.join end end
Version data entries
10 entries across 9 versions & 2 rubygems