Sha256: f7fd9fbb66e34a18ae058a0f54880250c1f81eb0f12ad05590d336416ed1dc53

Contents?: true

Size: 978 Bytes

Versions: 3

Compression:

Stored size: 978 Bytes

Contents

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

describe "Ps" 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.ps(:class => "lead").to_a.should == [browser.p(:class => "lead")]
      end
    end
  end
  
  describe "#length" do
    it "returns the number of ps" do
      browser.ps.length.should == 5
    end
  end

  describe "#[]" do
    it "returns the p at the given index" do
      browser.ps[0].id.should == "lead"
    end
  end

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

      browser.ps.each_with_index do |p, index|
        p.id.should == browser.p(:index, index).id
        p.value.should == browser.p(: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/ps_spec.rb
watir-webdriver-0.1.3 spec/watirspec/ps_spec.rb
watir-webdriver-0.1.2 spec/watirspec/ps_spec.rb