Sha256: 20b377340a2c6cb8e102c91bca3736d04edc4835133bc239251289bf05bc7e74

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'
require 'druid/elements'

describe Druid::Elements::TextField do
  describe "when mapping how to find an element" do
    it "should map watir types to same" do
      [:class, :id, :index, :name, :text, :xpath, :title, :label].each do |t|
        identifier = Druid::Elements::TextField.identifier_for t => 'value'
        expect(identifier.keys.first).to eql t
      end
    end
  end

  describe "interface" do
    let(:element) { double 'element' }
    let(:text_field) { Druid::Elements::TextField.new(element) }

    it "should set its' value" do
      expect(element).to receive(:set).with('test')
      text_field.value = 'test'
    end

    it "should register with type :text" do
      expect(Druid::Elements.element_class_for(:input, :text)).to be Druid::Elements::TextField
    end

    it "should register with type :password" do
      expect(Druid::Elements.element_class_for(:input, :password)).to be Druid::Elements::TextField
    end

    it "should append text" do
      expect(element).to receive(:append).with('abc')
      text_field.append('abc')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
druid-ts-1.2.2 spec/druid/elements/text_field_spec.rb
druid-ts-1.2.1 spec/druid/elements/text_field_spec.rb