Sha256: a27fde7f93abf7ea634af2c9b755f8f2a69212133c51c4495f29b5cf20a5217b

Contents?: true

Size: 720 Bytes

Versions: 30

Compression:

Stored size: 720 Bytes

Contents

require "webrat/core/locators/locator"

module Webrat
  module Locators

    class AreaLocator < Locator # :nodoc:

      def locate
        Area.load(@session, area_element)
      end

      def area_element
        area_elements.detect do |area_element|
          area_element["title"] =~ matcher ||
          area_element["id"] =~ matcher
        end
      end

      def matcher
        /#{Regexp.escape(@value.to_s)}/i
      end

      def area_elements
        @dom.xpath(*Area.xpath_search)
      end

      def error_message
        "Could not find area with name #{@value}"
      end

    end

    def find_area(id_or_title) #:nodoc:
      AreaLocator.new(@session, dom, id_or_title).locate!
    end

  end
end

Version data entries

30 entries across 30 versions & 15 rubygems

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