Sha256: 8875aa1681ac6944b59e4cecd8c830e18c0facf8911b58d43a1967ec3963df2c

Contents?: true

Size: 1017 Bytes

Versions: 15

Compression:

Stored size: 1017 Bytes

Contents

module Celerity
  class TableRow < Element
    include Enumerable
    include ClickableElement

    TAGS = [ Identifier.new('tr') ]
    DEFAULT_HOW = :id

    def locate
      super
      @cells = @object.getCells if @object
      @object
    end

    #
    # Yields each TableCell in this row to the given block.
    #

    def each
      assert_exists
      @cells.each { |cell| yield TableCell.new(self, :object, cell) }
    end

    def cells
      to_a
    end
    alias_method :tds, :cells

    #
    # Get the child cell at the given index
    #

    def child_cell(index)
      assert_exists

      if (index - Celerity.index_offset) >= @cells.length
        raise UnknownCellException, "Unable to locate a cell at index #{index}"
      end

      TableCell.new(self, :object, @cells[index - Celerity.index_offset])
    end
    alias_method :[], :child_cell

    #
    # Number of cells in this row.
    #

    def column_count
      assert_exists
      @cells.length
    end

  end # TableRow
end # Celerity

Version data entries

15 entries across 15 versions & 4 rubygems

Version Path
celerity_thingista-0.9.3 lib/celerity/elements/table_row.rb
celerity_thingista-0.9.2 lib/celerity/elements/table_row.rb
frameworks-capybara-0.2.0.rc6 vendor/bundle/ruby/1.8/gems/celerity-0.9.2/lib/celerity/elements/table_row.rb
frameworks-capybara-0.2.0.rc5 vendor/bundle/ruby/1.8/gems/celerity-0.9.2/lib/celerity/elements/table_row.rb
frameworks-capybara-0.2.0.rc4 vendor/bundle/ruby/1.8/gems/celerity-0.9.2/lib/celerity/elements/table_row.rb
frameworks-capybara-0.2.0.rc3 vendor/bundle/ruby/1.8/gems/celerity-0.9.2/lib/celerity/elements/table_row.rb
frameworks-capybara-0.2.0.rc2 vendor/bundle/ruby/1.8/gems/celerity-0.9.2/lib/celerity/elements/table_row.rb
celerity-0.9.2 lib/celerity/elements/table_row.rb
celerity-0.9.1 lib/celerity/elements/table_row.rb
no-click-exception-celerity-0.9.0 lib/celerity/elements/table_row.rb
celerity-0.9.0 lib/celerity/elements/table_row.rb
celerity-0.8.9 lib/celerity/elements/table_row.rb
celerity-0.8.9.pre lib/celerity/elements/table_row.rb
celerity-0.8.8 lib/celerity/elements/table_row.rb
celerity-0.8.7 lib/celerity/elements/table_row.rb