Sha256: d7a0ed81b6257501a6e7746681717bf548838bb0b45a564ae3848eb95fbef418

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

# encoding: utf-8
require File.expand_path('spec_helper', File.dirname(__FILE__))

describe "Forms" do

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

  describe "#length" do
    it "returns the number of forms in the container" do
      browser.forms.length.should == 2
    end
  end

  describe "#[]n" do
    bug "http://github.com/jarib/watir-webdriver/issues/issue/27", [:webdriver, :firefox], [:webdriver, :ie] do
      it "provides access to the nth form" do
        browser.forms[0].action.should == 'post_to_me'
        browser.forms[0].attribute_value('method').should == 'post'
      end
    end
  end

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

      browser.forms.each_with_index do |f, index|
        f.name.should == browser.form(:index, index).name
        f.id.should == browser.form(:index, index).id
        f.class_name.should == browser.form(:index, index).class_name

        count += 1
      end

      count.should > 0
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
watir-webdriver-0.0.9 spec/watirspec/forms_spec.rb
watir-webdriver-0.0.8 spec/watirspec/forms_spec.rb