Sha256: 7171a9e23b45d8b7b4d5b267dbfb4b5dea6eb0a6f05c0e52535a650564e34500

Contents?: true

Size: 1.27 KB

Versions: 3

Compression:

Stored size: 1.27 KB

Contents

# encoding: utf-8
require File.expand_path("../spec_helper", __FILE__)

describe "TextFields" do

  before :each do
    browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
  end

  bug "http://github.com/jarib/celerity/issues#issue/25", :celerity do
    describe "with selectors" do
      it "returns the matching elements" do
        browser.text_fields(:name => "new_user_email").to_a.should == [browser.text_field(:name => "new_user_email")]
      end
    end
  end
  
  describe "#length" do
    it "returns the number of text fields" do
      browser.text_fields.length.should == 9
    end
  end

  describe "#[]" do
    it "returns the text field at the given index" do
      browser.text_fields[0].id.should == "new_user_first_name"
      browser.text_fields[1].id.should == "new_user_last_name"
      browser.text_fields[2].id.should == "new_user_email"
    end
  end

  describe "#each" do
    it "iterates through text fields correctly" do
      count = 0

      browser.text_fields.each_with_index do |r, index|
        r.name.should == browser.text_field(:index, index).name
        r.id.should ==  browser.text_field(:index, index).id
        r.value.should == browser.text_field(:index, index).value

        count += 1
      end

      count.should > 0
    end
  end


end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
watir-webdriver-0.1.4 spec/watirspec/text_fields_spec.rb
watir-webdriver-0.1.3 spec/watirspec/text_fields_spec.rb
watir-webdriver-0.1.2 spec/watirspec/text_fields_spec.rb