Sha256: 186490255d91d578348d533313ee20e3cf2c8259da7a52a59f4c55f76e5dfa92

Contents?: true

Size: 1.46 KB

Versions: 5

Compression:

Stored size: 1.46 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, :value, :xpath].each do |t|
        identifier = radiobutton.watir_identifier_for t => 'value'
        expect(identifier.keys.first).to eql t
      end
    end
    it "should map selenium types to same" do
      [:class, :id, :name, :xpath, :value, :index].each do |t|
        key, value = radiobutton.selenium_identifier_for t => 'value'
        expect(key).to eql t
      end
    end
  end

  describe "interface" do

    it "should register as type :radio" do
      expect(::PageObject::Elements.element_class_for(:input, :radio)).to eql ::PageObject::Elements::RadioButton
    end
    
    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
        expect(selenium_rb).to receive(:click)
        expect(selenium_rb).to receive(:selected?).and_return(false)
        radio_button.select
      end
      
      it "should know if it is selected" do
        expect(selenium_rb).to receive(:selected?).and_return(true)
        expect(radio_button).to be_selected
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
page-object-lds-0.0.14 spec/page-object/elements/selenium/radio_button_spec.rb
page-object-lds-0.0.13 spec/page-object/elements/selenium/radio_button_spec.rb
page-object-lds-0.0.12 spec/page-object/elements/selenium/radio_button_spec.rb
page-object-lds-0.0.11 spec/page-object/elements/selenium/radio_button_spec.rb
page-object-lds-0.0.1 spec/page-object/elements/selenium/radio_button_spec.rb