Sha256: 6cdf53489548d78a6c50f6f6c1042a0b0ac2ad2238acb17c01588f63f886c014

Contents?: true

Size: 882 Bytes

Versions: 23

Compression:

Stored size: 882 Bytes

Contents

require "watirspec_helper"

describe "Labels" do

  before :each do
    browser.goto(WatirSpec.url_for("forms_with_input_elements.html"))
  end

  describe "with selectors" do
    it "returns the matching elements" do
      expect(browser.labels(for: "new_user_first_name").to_a).to eq [browser.label(for: "new_user_first_name")]
    end
  end

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

  describe "#[]" do
    it "returns the label at the given index" do
      expect(browser.labels[0].id).to eq "first_label"
    end
  end

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

      browser.labels.each_with_index do |l, index|
        expect(l.id).to eq browser.label(index: index).id
        count += 1
      end

      expect(count).to be > 0
    end
  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
watir-6.7.3 spec/watirspec/elements/labels_spec.rb
watir-6.7.2 spec/watirspec/elements/labels_spec.rb
watir-6.7.1 spec/watirspec/elements/labels_spec.rb
watir-6.7.0 spec/watirspec/elements/labels_spec.rb
watir-6.6.3 spec/watirspec/elements/labels_spec.rb
watir-6.6.2 spec/watirspec/elements/labels_spec.rb
watir-6.6.1 spec/watirspec/elements/labels_spec.rb
watir-6.6.0 spec/watirspec/elements/labels_spec.rb
watir-6.5.0 spec/watirspec/elements/labels_spec.rb
watir-6.4.3 spec/watirspec/elements/labels_spec.rb
watir-6.4.2 spec/watirspec/elements/labels_spec.rb
watir-6.4.1 spec/watirspec/elements/labels_spec.rb
watir-6.4.0 spec/watirspec/elements/labels_spec.rb
watir-6.4.0.rc2 spec/watirspec/elements/labels_spec.rb
watir-6.4.0.rc1 spec/watirspec/elements/labels_spec.rb
watir-6.3.0 spec/watirspec/elements/labels_spec.rb
watir-6.2.1 spec/watirspec/elements/labels_spec.rb
watir-6.2.0 spec/watirspec/elements/labels_spec.rb
watir-6.1.0 spec/watirspec/elements/labels_spec.rb
watir-6.0.3 spec/watirspec/elements/labels_spec.rb