Sha256: 5095a7371ee00ed99af2b762aac043c4be049590af2a2882a37705267b6b59c8

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

require 'spec_helper'

describe Symbiont::WebObjects::TextField do
  describe "implementation" do
    let(:text_field_object) { double('text_field_object') }
    let(:text_field_definition) { ::Symbiont::WebObjects::TextField.new(text_field_object) }
    let(:text_field) { Symbiont::WebObjects::TextField }

    it "should reference standard usable selectors" do
      [:class, :id, :name, :index, :xpath].each do |s|
        locator = text_field.provide_locator_for s => 'value'
        locator.keys.first.should == s
      end
    end

    it "should get the value of a text field" do
      text_field_object.should_receive(:value).and_return("testing")
      text_field_definition.value.should == "testing"
    end

    it "should set the value of a text field" do
      text_field_object.should_receive(:set).with("testing")
      text_field_definition.value = "testing"
    end

    it "should append text to a text field" do
      text_field_object.should_receive(:send_keys).with("testing")
      text_field_definition.append "testing"
    end

    it "should register with a text type" do
      ::Symbiont::WebObjects.get_class_for(:input, :text).should == ::Symbiont::WebObjects::TextField
    end

    it "should register with a password type" do
      ::Symbiont::WebObjects.get_class_for(:input, :password).should == ::Symbiont::WebObjects::TextField
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
symbiont-0.2.1 spec/symbiont/web_objects/text_field_spec.rb
symbiont-0.2.0 spec/symbiont/web_objects/text_field_spec.rb