Sha256: 8a750dad692a39f15b391ac12ed44ef77ecf871430f3c7c9e44316bb388762eb

Contents?: true

Size: 1.28 KB

Versions: 7

Compression:

Stored size: 1.28 KB

Contents

require File.expand_path('watirspec/spec_helper', File.dirname(__FILE__))

describe Watir::Input do

  before do
    browser.goto WatirSpec.url_for("forms_with_input_elements.html")
  end

  describe "#to_subtype" do
    it "returns a CheckBox instance" do
      e = browser.input(:xpath => "//input[@type='checkbox']").to_subtype
      expect(e).to be_kind_of(Watir::CheckBox)
    end

    it "returns a Radio instance" do
      e = browser.input(:xpath => "//input[@type='radio']").to_subtype
      expect(e).to be_kind_of(Watir::Radio)
    end

    it "returns a Button instance" do
      es = [
        browser.input(:xpath => "//input[@type='button']").to_subtype,
        browser.input(:xpath => "//input[@type='submit']").to_subtype
      ]

      es.all? { |e| expect(e).to be_kind_of(Watir::Button) }
    end

    it "returns a TextField instance" do
      e = browser.input(:xpath => "//input[@type='text']").to_subtype
      expect(e).to be_kind_of(Watir::TextField)
    end

    it "returns a TextField instance" do
      e = browser.input(:xpath => "//input[@type='file']").to_subtype
      expect(e).to be_kind_of(Watir::FileField)
    end
  end

  describe "#type" do
    it "returns an email type" do
      expect(browser.input(:name => "html5_email").type).to eq 'email'
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
watir-webdriver-0.6.11 spec/input_spec.rb
watir-webdriver-0.6.10 spec/input_spec.rb
watir-webdriver-0.6.9 spec/input_spec.rb
watir-webdriver-0.6.8 spec/input_spec.rb
watir-webdriver-0.6.7 spec/input_spec.rb
watir-webdriver-0.6.6 spec/input_spec.rb
watir-webdriver-0.6.5 spec/input_spec.rb