Sha256: 098649f42549ba3297f00807109e9196c648dc351fdd329204c0d0393532a26c

Contents?: true

Size: 1.46 KB

Versions: 5

Compression:

Stored size: 1.46 KB

Contents

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

describe PageObject::Elements::Area do
  let(:area) { PageObject::Elements::Area }

  context "when mapping how to find an element" do
    it "should map watir types to same" do
      [:class, :id, :index, :name, :xpath].each do |t|
        identifier = area.watir_identifier_for t => 'value'
        expect(identifier.keys.first).to eql t
      end
    end

    it "should map selenium types to same" do
      [:class, :id, :index, :name, :xpath].each do |t|
        key, value = area.selenium_identifier_for t => 'value'
        expect(key).to eql t
      end
    end
  end

  context "implementation" do
    let(:area_element) { double('area_element') }

    context "when using selenium" do
      let(:selenium_area) { PageObject::Elements::Area.new(area_element, :platform => :selenium_webdriver) }
      
      it "should know its coords" do
        expect(area_element).to receive(:attribute).with(:coords).and_return("1,2,3,4")
        expect(selenium_area.coords).to eql "1,2,3,4"
      end

      it "should know its shape" do
        expect(area_element).to receive(:attribute).with(:shape).and_return('circle')
        expect(selenium_area.shape).to eql 'circle'
      end

      it "should know its href" do
        expect(area_element).to receive(:attribute).with(:href).and_return('twitter.com')
        expect(selenium_area.href).to eql 'twitter.com'
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
page-object-lds-0.0.14 spec/page-object/elements/area_spec.rb
page-object-lds-0.0.13 spec/page-object/elements/area_spec.rb
page-object-lds-0.0.12 spec/page-object/elements/area_spec.rb
page-object-lds-0.0.11 spec/page-object/elements/area_spec.rb
page-object-lds-0.0.1 spec/page-object/elements/area_spec.rb