Sha256: 07f573e71c528b8f6201b3366a58310908f21cdeac4b29483911ae45a59c9fff

Contents?: true

Size: 1.34 KB

Versions: 13

Compression:

Stored size: 1.34 KB

Contents

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

describe PageObject::Elements::CheckBox do
  let(:checkbox) { PageObject::Elements::CheckBox }

  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 = checkbox.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 = checkbox.selenium_identifier_for t => 'value'
        key.should == t
      end
    end
  end
  
  describe "interface" do
    let(:check_box) { double('check_box') }
    let(:selenium_cb) { PageObject::Elements::CheckBox.new(check_box, :platform => :selenium_webdriver) }

    
    context "for selenium" do
      it "should check" do
        check_box.should_receive(:click)
        check_box.should_receive(:selected?).and_return(false)
        selenium_cb.check
      end

      it "should uncheck" do
        check_box.should_receive(:click)
        check_box.should_receive(:selected?).and_return(true)
        selenium_cb.uncheck
      end
      
      it "should know if it is checked" do
        check_box.should_receive(:selected?).and_return(true)
        selenium_cb.should be_checked
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
page-object-0.5.4 spec/page-object/elements/check_box_spec.rb
page-object-0.5.3 spec/page-object/elements/check_box_spec.rb
page-object-0.5.2 spec/page-object/elements/check_box_spec.rb
page-object-0.5.1 spec/page-object/elements/check_box_spec.rb
page-object-0.5.0 spec/page-object/elements/check_box_spec.rb
page-object-0.4.4 spec/page-object/elements/check_box_spec.rb
page-object-0.4.3 spec/page-object/elements/check_box_spec.rb
page-object-0.4.2 spec/page-object/elements/check_box_spec.rb
page-object-0.4.1 spec/page-object/elements/check_box_spec.rb
page-object-0.4.0 spec/page-object/elements/check_box_spec.rb
page-object-0.3.2 spec/page-object/elements/check_box_spec.rb
page-object-0.3.1 spec/page-object/elements/check_box_spec.rb
page-object-0.3.0 spec/page-object/elements/check_box_spec.rb