Sha256: f5d99e26996da4a10f2c355b4b05a9cdcd4a059165349bcc2d78ca98ee970279

Contents?: true

Size: 1.54 KB

Versions: 2

Compression:

Stored size: 1.54 KB

Contents

require_relative '../spec_helper'

describe 'Fluent::WebElements::UnorderedList' do

  it 'should register with a unordered list tag' do
    ::Fluent::WebElements.get_class_for(:ul).should == ::Fluent::WebElements::UnorderedList
  end

  context 'on the watir platform' do
    let(:ul_element) { double('ul_element') }
    let(:watir_unordered_list) { Fluent::WebElements::UnorderedList.new(ul_element, :platform => :watir_webdriver) }

    it 'should return a list item when indexed' do
      ul_element.stub(:uls).and_return([ul_element])
      ul_element.stub(:find_elements).and_return(ul_element)
      ul_element.stub(:map).and_return([ul_element])
      ul_element.stub(:parent).and_return(ul_element)
      ul_element.stub(:element).and_return(ul_element)
      ul_element.stub(:==).and_return(true)
      watir_unordered_list[1]
    end

    it 'should know how many list items it contains' do
      ul_element.stub(:uls).and_return([ul_element])
      ul_element.stub(:find_elements).and_return(ul_element)
      ul_element.stub(:map).and_return([ul_element])
      ul_element.stub(:parent).and_return(ul_element)
      ul_element.stub(:element).and_return(ul_element)
      ul_element.stub(:==).and_return(true)
      watir_unordered_list.items.should == 1
    end

    it 'should iterate over the list items' do
      watir_unordered_list.should_receive(:items).and_return(5)
      watir_unordered_list.stub(:[])
      count = 0
      watir_unordered_list.each { |item| count += 1 }
      count.should == 5
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fluent-0.4.0 spec/web_elements/unordered_list_spec.rb
fluent-0.3.0 spec/web_elements/unordered_list_spec.rb