Sha256: 3819da92a4164f858ed4b69ecde75aabcf157bbc781bae6e5c879a36ecbf5046

Contents?: true

Size: 1.84 KB

Versions: 2

Compression:

Stored size: 1.84 KB

Contents

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

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

  bug "http://github.com/jarib/celerity/issues#issue/25", :celerity do
    describe "with selectors" do
      it "returns the matching elements" do
        browser.theads(:id => "tax_headers").to_a.should == [browser.thead(:id => "tax_headers")]
      end
    end
  end
  
  describe "#length" do
    it "returns the correct number of table theads (page context)" do
      browser.theads.length.should == 1
    end

    it "returns the correct number of table theads (table context)" do
      browser.table(:index, 0).theads.length.should == 1
    end
  end

  describe "#[]" do
    it "returns the row at the given index (page context)" do
      browser.theads[0].id.should == "tax_headers"
    end

    it "returns the row at the given index (table context)" do
      browser.table(:index, 0).theads[0].id.should == "tax_headers"
    end
  end

  describe "#each" do
    it "iterates through table theads correctly (page context)" do
      browser.theads.each_with_index do |thead, index|
        thead.id.should == browser.thead(:index, index).id
      end
    end

    describe "#each" do
      it "iterates through table theads correctly (page context)" do
        count = 0

        browser.theads.each_with_index do |thead, index|
          thead.id.should == browser.thead(:index, index).id

          count += 1
        end

        count.should > 0
      end

      it "iterates through table theads correctly (table context)" do
        table = browser.table(:index, 0)
        count = 0

        table.theads.each_with_index do |thead, index|
          thead.id.should == table.thead(:index, index).id

          count += 1
        end

        count.should > 0
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
watir-webdriver-0.1.1 spec/watirspec/theads_spec.rb
watir-webdriver-0.1.0 spec/watirspec/theads_spec.rb