Sha256: 3a8f2703e1fd74d00806456a20a21e09763f7efefeb6b1858119423e919afdda

Contents?: true

Size: 1.65 KB

Versions: 20

Compression:

Stored size: 1.65 KB

Contents

module Celerity

  #
  # Input: Button
  #
  # Class representing button elements.
  #
  # This class covers both <button> and <input type="submit|reset|image|button" /> elements.
  #

  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

20 entries across 20 versions & 3 rubygems

Version Path
celerity-0.8.2 lib/celerity/elements/button.rb
celerity-0.8.1 lib/celerity/elements/button.rb
oki-celerity-0.8.2 lib/celerity/elements/button.rb
oki-celerity-0.8.1 lib/celerity/elements/button.rb
oki-celerity-0.8.1.dev lib/celerity/elements/button.rb
celerity-0.8.0 lib/celerity/elements/button.rb
celerity-0.8.0.beta.4 lib/celerity/elements/button.rb
celerity-0.8.0.beta.3 lib/celerity/elements/button.rb
celerity-0.8.0.beta.2 lib/celerity/elements/button.rb
celerity-0.8.0.beta.1 lib/celerity/elements/button.rb
fletcherm-culerity-0.2.9 vendor/gems/celerity-0.7.6/lib/celerity/elements/button.rb
fletcherm-culerity-0.2.8 vendor/gems/celerity-0.7.6/lib/celerity/elements/button.rb
celerity-0.7.9 lib/celerity/elements/button.rb
celerity-0.7.8 lib/celerity/elements/button.rb
fletcherm-culerity-0.2.7 vendor/gems/celerity-0.7.6/lib/celerity/elements/button.rb
celerity-0.7.7 lib/celerity/elements/button.rb
fletcherm-culerity-0.2.6 vendor/gems/celerity-0.7.6/lib/celerity/elements/button.rb
fletcherm-culerity-0.2.5 vendor/gems/celerity-0.7.6/lib/celerity/elements/button.rb
celerity-0.7.6 lib/celerity/elements/button.rb
celerity-0.7.5 lib/celerity/elements/button.rb