Sha256: 58951f9c6bccd33e476723a2e861adceb4ff230b8ca64e7641d5f6d6b2200a54

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

# encoding: utf-8
require File.expand_path('spec_helper', File.dirname(__FILE__))

describe "H1s", "H2s", "H3s", "H4s", "H5s", "H6s" 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.h1s(:class => "primary").to_a.should == [browser.h1(:class => "primary")]
      end
    end
  end
  
  describe "#length" do
    it "returns the number of h1s" do
      browser.h2s.length.should == 9
    end
  end

  describe "#[]" do
    it "returns the h1 at the given index" do
      browser.h1s[0].id.should == "first_header"
    end
  end

  describe "#each" do
    it "iterates through header collections correctly" do
      lengths = (1..6).collect do |i|
        collection = browser.send(:"h#{i}s")
        collection.each_with_index do |h, index|
          h.id.should == browser.send(:"h#{i}", :index, index).id
          h.value.should == browser.send(:"h#{i}", :index, index).value
        end
        collection.length
      end
      lengths.should == [2, 9, 2, 1, 1, 2]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
watir-webdriver-0.1.1 spec/watirspec/hns_spec.rb
watir-webdriver-0.1.0 spec/watirspec/hns_spec.rb