Sha256: 87bc206eb4c4808c47cc6a873be3fdadb3374cf6cb1bc111eac50ba6244ad77c

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

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

describe "FileFields" 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.file_fields(:class => "portrait").to_a.should == [browser.file_field(:class => "portrait")]
      end
    end
  end
  
  describe "#length" do
    it "returns the correct number of file fields" do
      browser.file_fields.length.should == 2
    end
  end

  describe "#[]" do
    it "returns the file field at the given index" do
      browser.file_fields[0].id.should == "new_user_portrait"
    end
  end

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

      browser.file_fields.each_with_index do |f, index|
        f.name.should == browser.file_field(:index, index).name
        f.id.should ==  browser.file_field(:index, index).id
        f.value.should == browser.file_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/filefields_spec.rb
watir-webdriver-0.1.3 spec/watirspec/filefields_spec.rb
watir-webdriver-0.1.2 spec/watirspec/filefields_spec.rb