Sha256: f0cf83c19f95cf2a5f412b6793676b2c4e84c4677c7152a667303b861f281ba2

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

# encoding: utf-8
require File.expand_path('spec_helper', File.dirname(__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

2 entries across 2 versions & 1 rubygems

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