Sha256: 36dfb5822b14c1915933f03671bcc22af944c60ed35f61b8e6c729547486af6a

Contents?: true

Size: 1.55 KB

Versions: 12

Compression:

Stored size: 1.55 KB

Contents

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

describe "TableCells" do

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

#  describe "#length" do
#    it "returns the number of cells" do
#      browser.table(:id, 'outer').cells.length.should == 6
#      browser.table(:id, 'inner').cells.length.should == 2
#    end
#  end
#
#  describe "#[]" do
#    it "returns the row at the given index" do
#      browser.table(:id, 'outer').cells[0].text.should == "Table 1, Row 1, Cell 1"
#      browser.table(:id, 'inner').cells[0].text.should == "Table 2, Row 1, Cell 1"
#      browser.table(:id, 'outer').cells[6].text.should == "Table 1, Row 3, Cell 2"
#    end
#  end

  describe "#each" do
    it "iterates through cells correctly" do
      # All cells on the page
      browser.cells.each_with_index do |c, index|
        c.id.should == browser.cell(:index, index).id
        c.value.should == browser.cell(:index, index).value
      end
      # Cells inside a table
      inner_table = browser.table(:id, 'inner')
      inner_table.cells.each_with_index do |c, index|
        c.id.should == inner_table.cell(:index, index).id
        c.value.should == inner_table.cell(:index, index).value
      end
      # Cells inside a table (should not include cells inside a table inside a table)
      outer_table = browser.table(:id, 'outer')
      outer_table.cells.each_with_index do |c, index|
        c.id.should == outer_table.cell(:index, index).id
        c.value.should == outer_table.cell(: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_cells_spec.rb
watir-webdriver-0.0.5 spec/watirspec/table_cells_spec.rb
watir-webdriver-0.0.4 spec/watirspec/table_cells_spec.rb
watir-webdriver-0.0.3 spec/watirspec/table_cells_spec.rb
watir-webdriver-0.0.2 spec/watirspec/table_cells_spec.rb
watir-webdriver-0.0.1 spec/watirspec/table_cells_spec.rb
watir-webdriver-0.0.1.dev7 spec/watirspec/table_cells_spec.rb
watir-webdriver-0.0.1.dev5 spec/watirspec/table_cells_spec.rb
watir-webdriver-0.0.1.dev4 spec/watirspec/table_cells_spec.rb
watir-webdriver-0.0.1.dev3 spec/watirspec/table_cells_spec.rb
watir-webdriver-0.0.1.dev2 spec/watirspec/table_cells_spec.rb
watir-webdriver-0.0.1.dev spec/watirspec/table_cells_spec.rb