Sha256: 49539ec040fdb9b45df0496b8125301483d7460726f3c6f29e9a4e5b6db0db9e

Contents?: true

Size: 1.47 KB

Versions: 5

Compression:

Stored size: 1.47 KB

Contents

require 'spec_helper'
require 'page-object/elements'

describe PageObject::Elements::Link do
  let(:link) { PageObject::Elements::Link }

  describe "when mapping how to find an element" do
    it "should map watir types to same" do
      [:class, :href, :id, :index, :name, :text, :xpath, :css].each do |t|
        identifier = link.watir_identifier_for t => 'value'
        identifier.keys.first.should == t
      end
    end

    it "should map selenium types to watir" do
      [:link, :link_text].each do |t|
        identifier = link.watir_identifier_for t => 'value'
        identifier.keys.first.should == :text
      end
    end

    it "should map selenium types to same" do
      [:class, :id, :link, :link_text, :name, :xpath, :index, :css].each do |t|
        key, value = link.selenium_identifier_for t => 'value'
        key.should == t
      end
    end

    it "should map watir types to selenium" do
      key, value = link.selenium_identifier_for :text => 'value'
      key.should == :link_text
    end
  end

  describe "interface" do
    let(:link_element) { double('link_element') }

    it "should register with tag :a" do
      ::PageObject::Elements.element_class_for(:a).should == ::PageObject::Elements::Link
    end

    context "for selenium" do
      it "should return error when asked for its' value" do
        link = PageObject::Elements::Link.new(link_element, :platform => :selenium_webdriver)
        lambda { link.value }.should raise_error
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
page-object-0.6.8 spec/page-object/elements/link_spec.rb
page-object-0.6.7 spec/page-object/elements/link_spec.rb
page-object-0.6.6 spec/page-object/elements/link_spec.rb
page-object-0.6.5 spec/page-object/elements/link_spec.rb
page-object-0.6.4 spec/page-object/elements/link_spec.rb