Sha256: ddeefae69ce6aab0abcfcdd5a1ee1cb224e401cc26f044dcbaf2c8425d00b694

Contents?: true

Size: 787 Bytes

Versions: 29

Compression:

Stored size: 787 Bytes

Contents

require "webrat/core/elements/element"

module Webrat
  class SelectOption < Element #:nodoc:

    def self.xpath_search
      [".//option"]
    end

    def choose
      select.raise_error_if_disabled
      select.set(value)
    end

    def unchoose
      select.raise_error_if_disabled
      select.unset(value)
    end

    def inner_text
      @element.inner_text
    end

  protected

    def select
      SelectField.load(@session, select_element)
    end

    def select_element
      parent = @element.parent

      while parent.respond_to?(:parent)
        return parent if parent.name == 'select'
        parent = parent.parent
      end
    end

    def value
      @element["value"] || @element.inner_html
    end

    def label
      @element.inner_html
    end

  end
end

Version data entries

29 entries across 29 versions & 14 rubygems

Version Path
radiant-1.0.0 ruby-debug/ruby/1.8/gems/webrat-0.7.3/lib/webrat/core/elements/select_option.rb
indirect-webrat-0.7.5 lib/webrat/core/elements/select_option.rb
indirect-webrat-0.7.4 lib/webrat/core/elements/select_option.rb
webrat-0.7.3 lib/webrat/core/elements/select_option.rb
jbd-webrat-0.7.2.rails3 lib/webrat/core/elements/select_option.rb
webrat-0.7.2 lib/webrat/core/elements/select_option.rb
webrat-0.7.2.beta.2 lib/webrat/core/elements/select_option.rb
mutle-webrat-0.7.2.beta.1 lib/webrat/core/elements/select_option.rb
thoughtbot-webrat-0.7.2.pre lib/webrat/core/elements/select_option.rb
webrat-0.7.2.beta.1 lib/webrat/core/elements/select_option.rb
honkster-webrat-0.7.1.2 lib/webrat/core/elements/select_option.rb
honkster-webrat-0.7.1.1 lib/webrat/core/elements/select_option.rb
revo-webrat-0.7.0.1 lib/webrat/core/elements/select_option.rb
webrat-0.7.1 lib/webrat/core/elements/select_option.rb
davidtrogers-webrat-0.7.0 lib/webrat/core/elements/select_option.rb
revo-webrat-0.7.0 lib/webrat/core/elements/select_option.rb
revo-webrat-0.7.1.pre lib/webrat/core/elements/select_option.rb
webrat-0.7.0 lib/webrat/core/elements/select_option.rb
honkster-webrat-0.6.0.10 lib/webrat/core/elements/select_option.rb
honkster-webrat-0.6.0.9 lib/webrat/core/elements/select_option.rb