Sha256: 40eb3347b57e540661d88f683d9e3cd06724866484d24d7d6d761ea34364ce55

Contents?: true

Size: 1.24 KB

Versions: 5

Compression:

Stored size: 1.24 KB

Contents

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

describe PageObject::Elements::FileField do

  describe "when mapping how to find an element" do
    let(:filefield) { PageObject::Elements::FileField }

    it "should map watir types to same" do
      [:class, :id, :index, :name, :xpath, :title].each do |t|
        identifier = filefield.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, :title].each do |t|
        key, value = filefield.selenium_identifier_for t => 'value'
        expect(key).to eql t
      end
    end
  end

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

    it "should register as type :file" do
      expect(::PageObject::Elements.element_class_for(:input, :file)).to eql ::PageObject::Elements::FileField
    end
    
    context "for selenium" do
      it "should set its' value" do
        selenium_file_field = PageObject::Elements::FileField.new(filefield, :platform => :selenium_webdriver)
        expect(filefield).to receive(:send_keys).with('a file')
        selenium_file_field.value = 'a file'
      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/file_field_spec.rb
page-object-lds-0.0.13 spec/page-object/elements/file_field_spec.rb
page-object-lds-0.0.12 spec/page-object/elements/file_field_spec.rb
page-object-lds-0.0.11 spec/page-object/elements/file_field_spec.rb
page-object-lds-0.0.1 spec/page-object/elements/file_field_spec.rb