Sha256: 4587b65739c0c0052a92b9aca8e165f8c3d027a9669eb1f117379ccfd651470f

Contents?: true

Size: 1.3 KB

Versions: 6

Compression:

Stored size: 1.3 KB

Contents

require 'spec_helper'
require 'druid/elements'

describe Druid::Elements::TableRow do
  describe "when mapping how to find an element" do
    it "should map watir types to same" do
      [:class, :id, :name, :xpath, :index].each do |t|
        identifier = Druid::Elements::TableRow.identifier_for t => 'value'
        expect(identifier.keys.first).to eql t
      end
    end
  end
  describe "interface" do
    let(:element) { double 'element' }
    let(:table_row) { Druid::Elements::TableRow.new(element) }

    it "should return a table cell when indexed" do
      allow(table_row).to receive(:columns).and_return(2)
      expect(element).to receive(:[]).with(1)
      expect(table_row[1]).to be_instance_of Druid::Elements::TableCell
    end

    it "should return the number of columns" do
      expect(element).to receive_message_chain(:cells, :size).and_return(3)
      expect(table_row.columns).to eql 3
    end

    it "should iterate  over the table columns" do
      expect(table_row).to receive(:columns).and_return(3)
      allow(table_row).to receive(:[])
      count = 0
      table_row.each do
        count += 1
      end
      expect(count).to eql 3
    end

    it "should register with tag_name :tr" do
      expect(Druid::Elements.element_class_for(:tr)).to be Druid::Elements::TableRow
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
druid-ts-1.2.2 spec/druid/elements/table_row_spec.rb
druid-ts-1.2.1 spec/druid/elements/table_row_spec.rb
druid-ts-1.2.0 spec/druid/elements/table_row_spec.rb
druid-ts-1.1.8 spec/druid/elements/table_row_spec.rb
druid-ts-1.1.7 spec/druid/elements/table_row_spec.rb
druid-ts-1.1.6 spec/druid/elements/table_row_spec.rb