Sha256: 9f5ba7f15861bba2e211dbd1e1500df0836d007a46c2cf7d86ab1978d0ae13aa

Contents?: true

Size: 906 Bytes

Versions: 6

Compression:

Stored size: 906 Bytes

Contents

require "watirspec_helper"

describe "Divs" 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.divs(id: "header").to_a).to eq [browser.div(id: "header")]
    end
  end

  describe "#length" do
    it "returns the number of divs" do
      expect(browser.divs.length).to eq 16
    end
  end

  describe "#[]" do
    it "returns the div at the given index" do
      expect(browser.divs[1].id).to eq "outer_container"
    end
  end

  describe "#each" do
    it "iterates through divs correctly" do
      count = 0

      browser.divs.each_with_index do |d, index|
        expect(d.id).to eq browser.div(index: index).id
        expect(d.class_name).to eq browser.div(index: index).class_name

        count += 1
      end

      expect(count).to be > 0
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
watir-6.11.0 spec/watirspec/elements/divs_spec.rb
watir-6.11.0.beta2 spec/watirspec/elements/divs_spec.rb
watir-6.11.0.beta1 spec/watirspec/elements/divs_spec.rb
watir-6.10.3 spec/watirspec/elements/divs_spec.rb
watir-6.10.2 spec/watirspec/elements/divs_spec.rb
watir-6.10.0 spec/watirspec/elements/divs_spec.rb