Sha256: b3e46863e464b32ce53a15b5233d77023ea7b2642660b8f9e91c56d4c89440b6

Contents?: true

Size: 1.56 KB

Versions: 2

Compression:

Stored size: 1.56 KB

Contents

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

describe "TableBodies" 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.tbodys(:id => "first").to_a.should == [browser.tbody(:id => "first")]
      end
    end
  end
  
  describe "#length" do
    it "returns the correct number of table bodies (page context)" do
      browser.tbodys.length.should == 5
    end

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

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

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

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

      browser.tbodys.each_with_index do |body, index|
        body.id.should == browser.tbody(:index, index).id

        count += 1
      end

      count.should > 0
    end

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

      table.tbodys.each_with_index do |body, index|
        body.id.should == table.tbody(:index, index).id

        count += 1
      end

      count.should > 0
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

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