Sha256: d125e4b3e6b2c2efde5978ef283fcc4271e907775d552bed08b6f6968df819a8

Contents?: true

Size: 1.23 KB

Versions: 7

Compression:

Stored size: 1.23 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

7 entries across 7 versions & 2 rubygems

Version Path
page-object-1.2.0 spec/page-object/elements/text_area_spec.rb
page-object-1.1.1 spec/page-object/elements/text_area_spec.rb
page_object-1.1.3 spec/page-object/elements/text_area_spec.rb
page_object-1.1.2 spec/page-object/elements/text_area_spec.rb
page_object-1.1.1 spec/page-object/elements/text_area_spec.rb
page-object-1.1.0 spec/page-object/elements/text_area_spec.rb
page-object-1.0.3 spec/page-object/elements/text_area_spec.rb