Sha256: a7a8d8ec4071a3449f183892c1123673d7a3397ada1c3cf8778aedb3974b76df

Contents?: true

Size: 1.32 KB

Versions: 13

Compression:

Stored size: 1.32 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].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].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') }

    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

13 entries across 13 versions & 1 rubygems

Version Path
page-object-0.5.4 spec/page-object/elements/link_spec.rb
page-object-0.5.3 spec/page-object/elements/link_spec.rb
page-object-0.5.2 spec/page-object/elements/link_spec.rb
page-object-0.5.1 spec/page-object/elements/link_spec.rb
page-object-0.5.0 spec/page-object/elements/link_spec.rb
page-object-0.4.4 spec/page-object/elements/link_spec.rb
page-object-0.4.3 spec/page-object/elements/link_spec.rb
page-object-0.4.2 spec/page-object/elements/link_spec.rb
page-object-0.4.1 spec/page-object/elements/link_spec.rb
page-object-0.4.0 spec/page-object/elements/link_spec.rb
page-object-0.3.2 spec/page-object/elements/link_spec.rb
page-object-0.3.1 spec/page-object/elements/link_spec.rb
page-object-0.3.0 spec/page-object/elements/link_spec.rb