Sha256: 4cd6a15d2a9ddd2baf3a2902c34c6620cba5f3665ce1629f85e919a1e80efe11

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'
require 'druid/elements'

describe Druid::Elements::UnOrderedList 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::UnOrderedList.identifier_for t => 'value'
        expect(identifier.keys.first).to eql t
      end
    end
  end

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

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

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

    it "should know how to iterate over the items" do
      expect(ul).to receive(:items).and_return(3)
      allow(ul).to receive(:[])
      count = 0
      ul.each do
        count += 1
      end
      expect(count).to eql 3
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

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