Sha256: 50dfaf55d57714a1874aac6467ba7eccf1f6c48c499a77dc684145772ab579a6

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

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

describe "Ems" 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.ems(:class => "important-class").to_a.should == [browser.em(:class => "important-class")]
      end
    end
  end
  
  describe "#length" do
    it "returns the number of ems" do
      browser.ems.length.should == 1
    end
  end

  describe "#[]" do
    it "returns the em at the given index" do
      browser.ems[0].id.should == "important-id"
    end
  end

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

      browser.ems.each_with_index do |e, index|
        e.text.should == browser.em(:index, index).text
        e.id.should == browser.em(:index, index).id
        e.class_name.should == browser.em(:index, index).class_name

        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/ems_spec.rb
watir-webdriver-0.1.3 spec/watirspec/ems_spec.rb
watir-webdriver-0.1.2 spec/watirspec/ems_spec.rb