Sha256: a9ae9330b523b9773fc109ffd5879da3915a741021bf3059ccb9d2134f7904f2

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

require File.dirname(__FILE__) + '/test_helper'

describe 'setting and getting values for individual checkboxes with value attributes in face definitions' do
  
  before do
    @page = Watirloo::Page.new
    @page.goto testfile('checkbox_group1.html')
    @page.add_face(
      :pets_cat => [:checkbox, :name, 'pets', 'cat'],
      :pets_dog => [:checkbox, :name, 'pets', 'dog'],
      :pets_zook => [:checkbox, :name, 'pets', 'zook'],
      :pets_zebra => [:checkbox, :name, 'pets', 'zebra'],
      :pets_wumpa => [:checkbox, :name, 'pets', 'wumpa'])
  end
  
  it 'semantic name accesses individual CheckBox' do
    if @page.b.kind_of?(FireWatir::Firefox)
      @page.face(:pets_cat).kind_of?(FireWatir::CheckBox).should == true
      
    elsif @page.b.kind_of?(Watir::IE)
      @page.face(:pets_cat).kind_of?(Watir::CheckBox).should == true
    end
  end
  
  it 'set individual checkbox does not set other checkboxes sharing the same name' do
    @page.face(:pets_dog).checked?.should == false
    @page.face(:pets_dog).set
    @page.face(:pets_dog).checked?.should == true
    @page.face(:pets_cat).checked?.should == false
  end
  
  it 'by default all are false. set each unchecked checkbox should have checked? true' do
    @page.faces.keys.each do |key|
      @page.face(key).checked?.should == false
    end

    @page.faces.keys.each do |key|
      @page.face(key).set
    end
    
    @page.faces.keys.each do |key|
      @page.face(key).checked?.should.be true    
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
marekj-watirloo-0.0.2 test/checkboxes_value_test.rb