Sha256: a61f0481ac84b4bf57738ae6d93d712003cce85701e29ee6c17e19b8ecd3c60c

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

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

describe "Radios" do

  before :each do
    browser.goto(WatirSpec.files + "/forms_with_input_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.radios(:value => "yes").to_a.should == [browser.radio(:value => "yes")]
      end
    end
  end
  
  describe "#length" do
    it "returns the number of radios" do
      browser.radios.length.should == 5
    end
  end

  describe "#[]" do
    it "returns the radio button at the given index" do
      browser.radios[0].id.should == "new_user_newsletter_yes"
    end
  end

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

      browser.radios.each_with_index do |r, index|
        r.name.should == browser.radio(:index, index).name
        r.id.should ==  browser.radio(:index, index).id
        r.value.should == browser.radio(: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/radios_spec.rb
watir-webdriver-0.1.3 spec/watirspec/radios_spec.rb
watir-webdriver-0.1.2 spec/watirspec/radios_spec.rb