Sha256: 7d993b1dae445f18bd8d577a75c1dd5828212ba2492ee8d9a86e7dfa8666f9ef

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 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
      allow(element).to receive(:uls).and_return(element)
      expect(element).to receive(:[])
      ul[1]
    end

    it "should know how many items it contains" do
      allow(element).to receive(:uls).and_return([element])
      expect(ul.items).to eql 1
    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.2.2 spec/druid/elements/unordered_list_spec.rb
druid-ts-1.2.1 spec/druid/elements/unordered_list_spec.rb