Sha256: 607d34f5e23a1c892c9b29fc00b0a0414c8c2ba708ba4a71a1c157dfd10a59ee

Contents?: true

Size: 1.3 KB

Versions: 3

Compression:

Stored size: 1.3 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

  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

3 entries across 3 versions & 1 rubygems

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