Sha256: 6210a137c532adbf739c128e495f5f7ded2afff2ca42d1a5f43104732fba440a

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe '#HTML Element Select' do

  before(:each) do
    file = File.join(File.dirname(__FILE__),"../","htdocs/select.html")
    @page = @metz.get "file://#{file}"
    @form = @page.forms.first
  end

  it 'should return list of Options' do
    options_value =  @form.field_with(name: 'numbers').options
    expect(options_value.count).to eq 6
  end

  it 'should return a list of Option Values' do
    options_value = @form.field_with(name: 'numbers').options.map(&:value)
    expect(options_value.count).to eq 6
  end

  it 'should return current value of option' do
    option_value = @form.field_with(name: 'numbers').value
    expect(option_value).to eq "4"
  end

  it 'should change when a new value is selected' do
    @form.field_with(name: 'numbers').value = '3'
    page = @page.forms.first
    option_value = page.field_with(name: 'numbers').value
    expect(option_value).to eq '3'
  end

  it 'should return the selected option' do
    option_value = @form.field_with(name: 'numbers').selected_options
    expect(option_value.first.selected).to eq true
  end

  it 'should inspect the option' do
    inspect = @form.field_with(name: 'numbers').inspect
    expect(inspect).to include('value: 4')
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
metallize-0.0.1 test/spec/select_spec.rb