Sha256: d2a1699747095dd5a5930627fa6d899ea18465e7bf4fd9a3fa0ee9cc7ce67d89

Contents?: true

Size: 935 Bytes

Versions: 2

Compression:

Stored size: 935 Bytes

Contents

module Watir
  module Locators
    class TextField
      class Matcher < Element::Matcher
        private

        def elements_match?(element, values_to_match)
          case element.tag_name.downcase
          when 'input'
            %i[text label visible_text].each do |key|
              next unless values_to_match.key?(key)

              values_to_match[:value] = values_to_match.delete(key)
            end
          when 'label'
            %i[value label].each do |key|
              next unless values_to_match.key?(key)

              values_to_match[:text] = values_to_match.delete(key)
            end
          else
            return
          end

          super
        end

        def text_regexp_deprecation(*)
          # does not apply to text_field
        end

        def validate_tag(element, _tag_name)
          matches_values?(element.tag_name.downcase, 'input')
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
watir-6.16.1 lib/watir/locators/text_field/matcher.rb
watir-6.16.0 lib/watir/locators/text_field/matcher.rb