Sha256: 285ed3a43f22156d7454ae1e198a3b63fc0e1e71bd365b696f08f5df151b00c3

Contents?: true

Size: 848 Bytes

Versions: 9

Compression:

Stored size: 848 Bytes

Contents

require File.dirname(__FILE__) + "/helper"

class TestFormButtons < Test::Unit::TestCase
  def setup
    @agent = WWW::Mechanize.new
  end

  def test_submit_button
    html = <<-END
    <html><body>
    <form><input type="submit" value="submit" /></form>
    </body></html>
    END
    page = WWW::Mechanize::Page.new(  nil, html_response, html, 200, @agent )
    assert_equal(1, page.forms.length)
    assert_equal(1, page.forms.first.buttons.length)
  end

  def test_button_button
    html = <<-END
    <html><body>
    <form><input type="button" value="submit" /></form>
    </body></html>
    END
    page = WWW::Mechanize::Page.new(  nil, html_response, html, 200, @agent )
    assert_equal(1, page.forms.length)
    assert_equal(1, page.forms.first.buttons.length)
  end

  def html_response
    { 'content-type' => 'text/html' }
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mechanize-0.7.3 test/tc_form_button.rb
mechanize-0.7.1 test/tc_form_button.rb
mechanize-0.7.0 test/tc_form_button.rb
mechanize-0.7.2 test/tc_form_button.rb
mechanize-0.7.4 test/tc_form_button.rb
mechanize-0.7.5 test/tc_form_button.rb
mechanize-0.7.6 test/tc_form_button.rb
mechanize-0.7.7 test/test_form_button.rb
mechanize-0.7.8 test/test_form_button.rb