Sha256: eda8e60d53a390b13fb1b7f329291f436d6a28f6c63aac989013610a2e0b3407

Contents?: true

Size: 1.38 KB

Versions: 7

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'
require 'page-object/elements'

describe PageObject::Elements::RadioButton do
  let(:radiobutton) { PageObject::Elements::RadioButton }

  describe "when mapping how to find an element" do
    it "should map watir types to same" do
      [:class, :id, :index, :name, :xpath].each do |t|
        identifier = radiobutton.watir_identifier_for t => 'value'
        identifier.keys.first.should == t
      end
    end
    it "should map selenium types to same" do
      [:class, :id, :name, :xpath, :index].each do |t|
        key, value = radiobutton.selenium_identifier_for t => 'value'
        key.should == t
      end
    end
  end

  describe "interface" do
    context "for selenium" do
      let(:selenium_rb) { double('radio_button') }
      let(:radio_button) { PageObject::Elements::RadioButton.new(selenium_rb, :platform => :selenium_webdriver) }

      it "should select" do
        selenium_rb.should_receive(:click)
        selenium_rb.should_receive(:selected?).and_return(false)
        radio_button.select
      end
      
      it "should clear" do
        selenium_rb.should_receive(:click)
        selenium_rb.should_receive(:selected?).and_return(true)
        radio_button.clear
      end
      
      it "should know if it is selected" do
        selenium_rb.should_receive(:selected?).and_return(true)
        radio_button.should be_selected
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
page-object-0.4.3 spec/page-object/elements/radio_button_spec.rb
page-object-0.4.2 spec/page-object/elements/radio_button_spec.rb
page-object-0.4.1 spec/page-object/elements/radio_button_spec.rb
page-object-0.4.0 spec/page-object/elements/radio_button_spec.rb
page-object-0.3.2 spec/page-object/elements/radio_button_spec.rb
page-object-0.3.1 spec/page-object/elements/radio_button_spec.rb
page-object-0.3.0 spec/page-object/elements/radio_button_spec.rb