Sha256: 548d022f775e0e113a92162d660a8147fdd0e82270b23ad2ed4a0888342be69c

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'
require 'druid/elements'

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

  describe "interface" do
    let(:element) { double 'element' }
    let(:ol) { Druid::Elements::OrderedList.new(element) }

    it "should return a list item when indexed" do
      expect(element).to receive(:li)
      expect(ol[1]).to be_instance_of Druid::Elements::ListItem
    end

    it "should know how many list items it contains" do
      expect(element).to receive_message_chain(:lis, :size).and_return(2)
      expect(ol.items).to eql 2
    end

    it "should iterate over the list items" do
      expect(ol).to receive(:items).and_return(2)
      allow(ol).to receive(:[])
      count = 0
      ol.each do
        count += 1
      end
      expect(count).to eql 2
    end

    it "should register as tag_name :ol" do
      expect(Druid::Elements.element_class_for(:ol)).to be Druid::Elements::OrderedList
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
druid-ts-1.1.1 spec/druid/elements/ordered_list_spec.rb
druid-ts-1.1.0 spec/druid/elements/ordered_list_spec.rb