Sha256: 3762c0368ea5fd8afd5daae60241321a3ddb74676468f5b9aff2ffa0f0db46cc

Contents?: true

Size: 1.46 KB

Versions: 12

Compression:

Stored size: 1.46 KB

Contents

# encoding: utf-8
require File.dirname(__FILE__) + '/spec_helper'

describe "TableRows" do

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

  describe "#length" do
    bug "WTR-354", :watir do
      it "returns the correct number of cells (table context)" do
        browser.table(:id, 'inner').rows.length.should == 1
        browser.table(:id, 'outer').rows.length.should == 3
      end
    end

    it "returns the correct number of cells (page context)" do
      browser.rows.length.should == 14
    end
  end

  describe "#[]" do
    it "returns the row at the given index (table context)" do
      browser.table(:id, 'outer').rows[0].id.should == "outer_first"
    end

    it "returns the row at the given index (page context)" do
      browser.rows[0].id.should == "thead_row_1"
    end
  end

  describe "#each" do
      it "iterates through rows correctly" do
      # rows inside a table
      inner_table = browser.table(:id, 'inner')
      inner_table.rows.each_with_index do |r, index|
        r.id.should == inner_table.row(:index, index).id
        r.value.should == inner_table.row(:index, index).value
      end
      # rows inside a table (should not include rows inside a table inside a table)
      outer_table = browser.table(:id, 'outer')
      outer_table.rows.each_with_index do |r, index|
        r.id.should == outer_table.row(:index, index).id
        r.value.should == outer_table.row(:index, index).value
      end
    end
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
watir-webdriver-0.0.6 spec/watirspec/table_rows_spec.rb
watir-webdriver-0.0.5 spec/watirspec/table_rows_spec.rb
watir-webdriver-0.0.4 spec/watirspec/table_rows_spec.rb
watir-webdriver-0.0.3 spec/watirspec/table_rows_spec.rb
watir-webdriver-0.0.2 spec/watirspec/table_rows_spec.rb
watir-webdriver-0.0.1 spec/watirspec/table_rows_spec.rb
watir-webdriver-0.0.1.dev7 spec/watirspec/table_rows_spec.rb
watir-webdriver-0.0.1.dev5 spec/watirspec/table_rows_spec.rb
watir-webdriver-0.0.1.dev4 spec/watirspec/table_rows_spec.rb
watir-webdriver-0.0.1.dev3 spec/watirspec/table_rows_spec.rb
watir-webdriver-0.0.1.dev2 spec/watirspec/table_rows_spec.rb
watir-webdriver-0.0.1.dev spec/watirspec/table_rows_spec.rb