Sha256: 24f7e81407a37799b4a401c4b013cd3a160c4e563b78367cb274c64ba748a2ec

Contents?: true

Size: 1.27 KB

Versions: 5

Compression:

Stored size: 1.27 KB

Contents

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

describe PageObject::Elements::TextArea do
  let(:textarea) { PageObject::Elements::TextArea }

  describe "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 = textarea.watir_identifier_for t => 'value'
        expect(identifier.keys.first).to eql t
      end
    end

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

    it "should register with tag_name :textarea" do
      expect(::PageObject::Elements.element_class_for(:textarea)).to eql ::PageObject::Elements::TextArea
    end
    
    context "for Selenium" do
      it "should set its' value" do
        text_area_element = double('text_area')
        text_area = PageObject::Elements::TextArea.new(text_area_element, :platform => :selenium_webdriver)
        expect(text_area_element).to receive(:clear)
        expect(text_area_element).to receive(:send_keys).with('Joseph')
        text_area.value = 'Joseph'
      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/text_area_spec.rb
page-object-lds-0.0.13 spec/page-object/elements/text_area_spec.rb
page-object-lds-0.0.12 spec/page-object/elements/text_area_spec.rb
page-object-lds-0.0.11 spec/page-object/elements/text_area_spec.rb
page-object-lds-0.0.1 spec/page-object/elements/text_area_spec.rb