Sha256: 7250b8ac1c6ec3126434a30c21df67eb32f5c06258f1055ea4550b3f43a512f3

Contents?: true

Size: 931 Bytes

Versions: 25

Compression:

Stored size: 931 Bytes

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

  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[3].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
      index = 0
      browser.links.each do |c|
        index += 1
        c.name.should == browser.link(:index, index).name
        c.id.should == browser.link(:index, index).id
        c.value.should == browser.link(:index, index).value
      end
      browser.links.length.should == index
    end
  end

end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
operawatir-0.7.pre4-jruby spec/watir2/links_spec.rb
operawatir-0.7.pre3-jruby spec/watir2/links_spec.rb
operawatir-0.7.pre2-jruby spec/watir2/links_spec.rb
operawatir-0.7.pre1-jruby spec/watir2/links_spec.rb
operawatir-0.6.pre1-jruby spec/watir2/links_spec.rb
operawatir-0.5.1-jruby spec/watir2/links_spec.rb
operawatir-0.5-jruby spec/watir2/links_spec.rb
operawatir-0.5.pre3-jruby spec/watir2/links_spec.rb
operawatir-0.5.pre2-jruby spec/watir2/links_spec.rb
operawatir-0.5.pre1-jruby spec/watir2/links_spec.rb
operawatir-0.4.3.pre1-jruby spec/watir2/links_spec.rb
operawatir-0.4.2-jruby spec/watir2/links_spec.rb
operawatir-0.4.1-jruby spec/watir2/links_spec.rb
operawatir-0.4.1.pre7-jruby spec/watir2/links_spec.rb
operawatir-0.4.1.pre6-jruby spec/watir2/links_spec.rb
operawatir-0.4.1.pre5-jruby spec/watir2/links_spec.rb
operawatir-0.4.1.pre4-jruby spec/watir2/links_spec.rb
operawatir-0.4.1.pre3-jruby spec/watir2/links_spec.rb
operawatir-0.4.1.pre2-jruby spec/watir2/links_spec.rb
operawatir-0.4.1.pre1-jruby spec/watir2/links_spec.rb