Sha256: 7fcbde3efd675695d5e801e3eda84a16c7eaee42cdd4da2250dc3b2ec88947d5

Contents?: true

Size: 1.93 KB

Versions: 25

Compression:

Stored size: 1.93 KB

Contents

# encoding: utf-8
require File.expand_path("../spec_helper", __FILE__)

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[1].text.should == "Table 1, Row 1, Cell 1"
#      browser.table(:id, 'inner').cells[1].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
      count = 0

      browser.cells.each_with_index do |c, index|
        c.name.should == browser.cell(:index, index+1).name
        c.id.should == browser.cell(:index, index+1).id
        c.value.should == browser.cell(:index, index+1).value

        count += 1
      end

      count.should > 0

      # Cells inside a table
      count = 0

      inner_table = browser.table(:id, 'inner')

      inner_table.cells.each_with_index do |c, index|
        c.name.should == inner_table.cell(:index, index+1).name
        c.id.should == inner_table.cell(:index, index+1).id
        c.value.should == inner_table.cell(:index, index+1).value

        count += 1
      end

      count.should > 0

      # Cells inside a table (should not include cells inside a table inside a table)
      outer_table = browser.table(:id, 'outer')
      count = 0

      outer_table.cells.each_with_index do |c, index|
        c.name.should == outer_table.cell(:index, index+1).name
        c.id.should == outer_table.cell(:index, index+1).id
        c.value.should == outer_table.cell(:index, index+1).value

        count += 1
      end

      count.should > 0
    end
  end

end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
operawatir-0.7.pre4-jruby spec/watir2/table_cells_spec.rb
operawatir-0.7.pre3-jruby spec/watir2/table_cells_spec.rb
operawatir-0.7.pre2-jruby spec/watir2/table_cells_spec.rb
operawatir-0.7.pre1-jruby spec/watir2/table_cells_spec.rb
operawatir-0.6.pre1-jruby spec/watir2/table_cells_spec.rb
operawatir-0.5.1-jruby spec/watir2/table_cells_spec.rb
operawatir-0.5-jruby spec/watir2/table_cells_spec.rb
operawatir-0.5.pre3-jruby spec/watir2/table_cells_spec.rb
operawatir-0.5.pre2-jruby spec/watir2/table_cells_spec.rb
operawatir-0.5.pre1-jruby spec/watir2/table_cells_spec.rb
operawatir-0.4.3.pre1-jruby spec/watir2/table_cells_spec.rb
operawatir-0.4.2-jruby spec/watir2/table_cells_spec.rb
operawatir-0.4.1-jruby spec/watir2/table_cells_spec.rb
operawatir-0.4.1.pre7-jruby spec/watir2/table_cells_spec.rb
operawatir-0.4.1.pre6-jruby spec/watir2/table_cells_spec.rb
operawatir-0.4.1.pre5-jruby spec/watir2/table_cells_spec.rb
operawatir-0.4.1.pre4-jruby spec/watir2/table_cells_spec.rb
operawatir-0.4.1.pre3-jruby spec/watir2/table_cells_spec.rb
operawatir-0.4.1.pre2-jruby spec/watir2/table_cells_spec.rb
operawatir-0.4.1.pre1-jruby spec/watir2/table_cells_spec.rb