Sha256: 08702fc31d3714b58695dd7e1827733e09ae61011713f934642a94e19b120fc4

Contents?: true

Size: 1.66 KB

Versions: 18

Compression:

Stored size: 1.66 KB

Contents

module Celerity

  #
  # Input: Button
  #
  # Class representing button elements.
  #
  # This class covers both button elements and input elements with type submit|reset|image|button.
  #

  class Button < InputElement
    TAGS = [ Identifier.new('button'),
             Identifier.new('input', :type => %w[submit reset image button]) ]

    # Attribute list is a little weird due to this class covering both <button>
    # and <input type="submit|reset|image|button" />
    ATTRIBUTES = ATTRIBUTES | [
                                :accesskey,
                                :disabled,
                                :ismap,
                                :onblur,
                                :onfocus,
                                :src,
                                :tabindex,
                                :type,
                                :usemap,
                              ]
    DEFAULT_HOW = :value

    #
    # @api private
    #

    def locate
      # We want the :value attribute to point to the inner text for <button> elements,
      # and to the value attribute for <input type="button"> elements.
      if (val = @conditions[:value])
        button_ident      = Identifier.new('button')
        button_ident.text = val
        input_ident       = Identifier.new('input', :type => %w[submit reset image button], :value => [val])

        locator        = ElementLocator.new(@container, self.class)
        locator.idents = [button_ident, input_ident]

        conditions = @conditions.dup
        conditions.delete(:value)
        @object = locator.find_by_conditions(conditions)
      else
        super
      end
    end

  end # Button
end # Celerity

Version data entries

18 entries across 18 versions & 4 rubygems

Version Path
celerity_thingista-0.9.3 lib/celerity/elements/button.rb
celerity_thingista-0.9.2 lib/celerity/elements/button.rb
frameworks-capybara-0.2.0.rc6 vendor/bundle/ruby/1.8/gems/celerity-0.9.2/lib/celerity/elements/button.rb
frameworks-capybara-0.2.0.rc5 vendor/bundle/ruby/1.8/gems/celerity-0.9.2/lib/celerity/elements/button.rb
frameworks-capybara-0.2.0.rc4 vendor/bundle/ruby/1.8/gems/celerity-0.9.2/lib/celerity/elements/button.rb
frameworks-capybara-0.2.0.rc3 vendor/bundle/ruby/1.8/gems/celerity-0.9.2/lib/celerity/elements/button.rb
frameworks-capybara-0.2.0.rc2 vendor/bundle/ruby/1.8/gems/celerity-0.9.2/lib/celerity/elements/button.rb
celerity-0.9.2 lib/celerity/elements/button.rb
celerity-0.9.1 lib/celerity/elements/button.rb
no-click-exception-celerity-0.9.0 lib/celerity/elements/button.rb
celerity-0.9.0 lib/celerity/elements/button.rb
celerity-0.8.9 lib/celerity/elements/button.rb
celerity-0.8.9.pre lib/celerity/elements/button.rb
celerity-0.8.8 lib/celerity/elements/button.rb
celerity-0.8.7 lib/celerity/elements/button.rb
celerity-0.8.6 lib/celerity/elements/button.rb
celerity-0.8.5 lib/celerity/elements/button.rb
celerity-0.8.4 lib/celerity/elements/button.rb