Sha256: 750f2b263e5446799c5b6189a96725a40cf3f1bbd8a7068353d686b920c80285

Contents?: true

Size: 832 Bytes

Versions: 7

Compression:

Stored size: 832 Bytes

Contents

require 'watirspec_helper'

describe 'Spans' do
  before :each do
    browser.goto(WatirSpec.url_for('non_control_elements.html'))
  end

  describe 'with selectors' do
    it 'returns the matching elements' do
      expect(browser.spans(class: 'footer').to_a).to eq [browser.span(class: 'footer')]
    end
  end

  describe '#length' do
    it 'returns the number of spans' do
      expect(browser.spans.length).to eq 8
    end
  end

  describe '#[]' do
    it 'returns the p at the given index' do
      expect(browser.spans[0].id).to eq 'lead'
    end
  end

  describe '#each' do
    it 'iterates through spans correctly' do
      count = 0

      browser.spans.each_with_index do |s, index|
        expect(s.id).to eq browser.span(index: index).id
        count += 1
      end

      expect(count).to be > 0
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
watir-7.1.0 spec/watirspec/elements/spans_spec.rb
watir-7.0.0 spec/watirspec/elements/spans_spec.rb
watir-7.0.0.beta5 spec/watirspec/elements/spans_spec.rb
watir-7.0.0.beta4 spec/watirspec/elements/spans_spec.rb
watir-7.0.0.beta3 spec/watirspec/elements/spans_spec.rb
watir-7.0.0.beta2 spec/watirspec/elements/spans_spec.rb
watir-7.0.0.beta1 spec/watirspec/elements/spans_spec.rb