Sha256: 01071434d216e9837b0a04394162710a1526368d4e6acc09082d5784518e9c52

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

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

describe "SelectList options as visible items and values as hidden to the user attributes" do
  
  include Watirloo::Page

  face(:pets) { doc.select_list(:name, 'animals') }
  face(:gender) { doc.select_list(:name, 'sex_cd') }
  face(:toys) { doc.select_list(:name, 'bubel') }
  
  before :each do
    browser.goto testfile('select_lists.html')
  end
  
  it 'values of options by facename method' do
    gender.values.should == ['', 'm', 'f']
    pets.values.should == ['o1', 'o2', 'o3', 'o4', 'o5']
  end
  
  it 'options with no value attribute' do
    # in case of IE it will return all blanks
    if browser.kind_of?(Watir::IE)
      toys.values.should == ["", "", "", "", ""]
    elsif browser.kind_of?(FireWatir::Firefox)
      toys.values.should == ["", "foobel", "barbel", "bazbel", "chuchu"]
      # for Firfox it returns actual items
    end
  end
  
  it 'items method returns visible contents as array of text items' do
    toys.items.should == ["", "foobel", "barbel", "bazbel", "chuchu"]
  end
  
  it 'items returns visible text items as array' do
    pets.items.should == ['cat', 'dog', 'zook', 'zebra', 'wumpa']
    gender.items.should == ["", "M", "F"]
  end
  
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
marekj-watirloo-0.0.5 spec/select_list_options_spec.rb