Sha256: d2620644223f4cf5e7c50f923176b8f24d64bf0c2d37330e790e188541f655c7

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

# encoding: utf-8
require File.expand_path("../spec_helper", __FILE__)

describe "Links" do

  before :each do
    browser.goto(WatirSpec.files + "/non_control_elements.html")
  end

  bug "http://github.com/jarib/celerity/issues#issue/25", :celerity do
    describe "with selectors" do
      it "returns the matching elements" do
        browser.links(:title => "link_title_2").to_a.should == [browser.link(:title => "link_title_2")]
      end
    end
  end
  
  describe "#length" do
    it "returns the number of links" do
      browser.links.length.should == 4
    end
  end

  describe "#[]" do
    it "returns the link at the given index" do
      browser.links[2].id.should == "link_3"
    end

    it "returns a Link object also when the index is out of bounds" do
      browser.links[2000].should_not be_nil
    end
  end

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

      browser.links.each_with_index do |c, index|
        c.id.should == browser.link(:index, index).id
        c.value.should == browser.link(:index, index).value

        count += 1
      end

      count.should > 0
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
watir-webdriver-0.1.4 spec/watirspec/links_spec.rb
watir-webdriver-0.1.3 spec/watirspec/links_spec.rb
watir-webdriver-0.1.2 spec/watirspec/links_spec.rb