Sha256: 30f78c37ffb227c9f5fe3e6d406d5662bd996c7fb964bfdef342e56466f7426f

Contents?: true

Size: 1.04 KB

Versions: 25

Compression:

Stored size: 1.04 KB

Contents

module Watir
  class TextField < Input
    include UserEditable

    NON_TEXT_TYPES = %w[file radio checkbox submit reset image button hidden range color]

    inherit_attributes_from Watir::TextArea
    remove_method :type # we want Input#type here, which was overriden by TextArea's attributes

    protected

    def selector_string
      selector = @selector.dup
      selector[:type] = '(any text type)'
      selector[:tag_name] = "input or textarea"

      if @query_scope.is_a?(Browser) || @query_scope.is_a?(IFrame)
        super
      else
        "#{@query_scope.selector_string} --> #{selector.inspect}"
      end
    end
  end # TextField

  module Container
    def text_field(*args)
      TextField.new(self, extract_selector(args).merge(tag_name: "input"))
    end

    def text_fields(*args)
      TextFieldCollection.new(self, extract_selector(args).merge(tag_name: "input"))
    end
  end # Container

  class TextFieldCollection < InputCollection
    private

    def element_class
      TextField
    end
  end # TextFieldCollection
end # Watir

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
watir-6.8.0 lib/watir/elements/text_field.rb
watir-6.7.3 lib/watir/elements/text_field.rb
watir-6.7.2 lib/watir/elements/text_field.rb
watir-6.7.1 lib/watir/elements/text_field.rb
watir-6.7.0 lib/watir/elements/text_field.rb
watir-6.6.3 lib/watir/elements/text_field.rb
watir-6.6.2 lib/watir/elements/text_field.rb
watir-6.6.1 lib/watir/elements/text_field.rb
watir-6.6.0 lib/watir/elements/text_field.rb
watir-6.5.0 lib/watir/elements/text_field.rb
watir-6.4.3 lib/watir/elements/text_field.rb
watir-6.4.2 lib/watir/elements/text_field.rb
watir-6.4.1 lib/watir/elements/text_field.rb
watir-6.4.0 lib/watir/elements/text_field.rb
watir-6.4.0.rc2 lib/watir/elements/text_field.rb
watir-6.4.0.rc1 lib/watir/elements/text_field.rb
watir-6.3.0 lib/watir/elements/text_field.rb
watir-6.2.1 lib/watir/elements/text_field.rb
watir-6.2.0 lib/watir/elements/text_field.rb
watir-6.1.0 lib/watir/elements/text_field.rb