Sha256: d78f2d869f868217395f4efe9373f7a3df922f26980a7e7828d509cb20958eac

Contents?: true

Size: 977 Bytes

Versions: 14

Compression:

Stored size: 977 Bytes

Contents

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

        def elements_match?(element, values_to_match)
          case fetch_value(element, :tag_name)
          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, _expected)
          tag_name = fetch_value(element, :tag_name)
          matches_values?(tag_name, 'input')
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
watir-7.1.0 lib/watir/locators/text_field/matcher.rb
watir-7.0.0 lib/watir/locators/text_field/matcher.rb
watir-7.0.0.beta5 lib/watir/locators/text_field/matcher.rb
watir-7.0.0.beta4 lib/watir/locators/text_field/matcher.rb
watir-7.0.0.beta3 lib/watir/locators/text_field/matcher.rb
watir-7.0.0.beta2 lib/watir/locators/text_field/matcher.rb
watir-7.0.0.beta1 lib/watir/locators/text_field/matcher.rb
watir-6.19.1 lib/watir/locators/text_field/matcher.rb
watir-6.19.0 lib/watir/locators/text_field/matcher.rb
watir-6.18.0 lib/watir/locators/text_field/matcher.rb
watir-6.17.0 lib/watir/locators/text_field/matcher.rb
watir-6.16.5 lib/watir/locators/text_field/matcher.rb
watir-6.16.4 lib/watir/locators/text_field/matcher.rb
watir-6.16.3 lib/watir/locators/text_field/matcher.rb