Sha256: 2b839a1ff5fccb7d01fff7eb8fb12927821c26324837545c9f786caff0ba53bd

Contents?: true

Size: 553 Bytes

Versions: 23

Compression:

Stored size: 553 Bytes

Contents

require "webrat/core/elements/element"

module Webrat
  class Label < Element #:nodoc:
    
    attr_reader :element
    
    def self.xpath_search
      ".//label"
    end

    def for_id
      Webrat::XML.attribute(@element, "for")
    end
    
    def field
      Field.load(@session, field_element)
    end
    
  protected
  
    def field_element
      if for_id.blank?
        Webrat::XML.xpath_at(@element, *Field.xpath_search)
      else
        Webrat::XML.css_search(@session.current_dom, "#" + for_id).first
      end
    end
    
  end
end

Version data entries

23 entries across 23 versions & 4 rubygems

Version Path
adva-0.3.2 test/webrat/lib/webrat/core/elements/label.rb
adva-0.3.1 test/webrat/lib/webrat/core/elements/label.rb
adva-0.3.0 test/webrat/lib/webrat/core/elements/label.rb
adva-0.2.4 test/webrat/lib/webrat/core/elements/label.rb
adva-0.2.3 test/webrat/lib/webrat/core/elements/label.rb
adva-0.2.2 test/webrat/lib/webrat/core/elements/label.rb
adva-0.2.1 test/webrat/lib/webrat/core/elements/label.rb
adva-0.2.0 test/webrat/lib/webrat/core/elements/label.rb
adva-0.1.4 test/webrat/lib/webrat/core/elements/label.rb
adva-0.1.3 test/webrat/lib/webrat/core/elements/label.rb
adva-0.1.2 test/webrat/lib/webrat/core/elements/label.rb
adva-0.1.1 test/webrat/lib/webrat/core/elements/label.rb
adva-0.1.0 test/webrat/lib/webrat/core/elements/label.rb
adva-0.0.1 test/webrat/lib/webrat/core/elements/label.rb
auxesis-webrat-0.4.1 lib/webrat/core/elements/label.rb
jwilger-webrat-0.4.2.1 lib/webrat/core/elements/label.rb
jwilger-webrat-0.4.2.2 lib/webrat/core/elements/label.rb
jwilger-webrat-0.4.2.3 lib/webrat/core/elements/label.rb
jwilger-webrat-0.4.2.4 lib/webrat/core/elements/label.rb
jwilger-webrat-0.4.2.5 lib/webrat/core/elements/label.rb