yannp-capybara 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +112 -0
- data/README.rdoc +442 -0
- data/lib/capybara/cucumber.rb +32 -0
- data/lib/capybara/driver/base.rb +56 -0
- data/lib/capybara/driver/celerity_driver.rb +154 -0
- data/lib/capybara/driver/culerity_driver.rb +26 -0
- data/lib/capybara/driver/node.rb +66 -0
- data/lib/capybara/driver/rack_test_driver.rb +279 -0
- data/lib/capybara/driver/selenium_driver.rb +157 -0
- data/lib/capybara/dsl.rb +98 -0
- data/lib/capybara/node/actions.rb +156 -0
- data/lib/capybara/node/finders.rb +155 -0
- data/lib/capybara/node/matchers.rb +97 -0
- data/lib/capybara/node.rb +209 -0
- data/lib/capybara/rails.rb +17 -0
- data/lib/capybara/server.rb +101 -0
- data/lib/capybara/session.rb +278 -0
- data/lib/capybara/spec/driver.rb +190 -0
- data/lib/capybara/spec/fixtures/capybara.jpg +0 -0
- data/lib/capybara/spec/fixtures/test_file.txt +1 -0
- data/lib/capybara/spec/public/jquery-ui.js +35 -0
- data/lib/capybara/spec/public/jquery.js +19 -0
- data/lib/capybara/spec/public/test.js +33 -0
- data/lib/capybara/spec/session/all_spec.rb +73 -0
- data/lib/capybara/spec/session/attach_file_spec.rb +64 -0
- data/lib/capybara/spec/session/check_spec.rb +67 -0
- data/lib/capybara/spec/session/choose_spec.rb +26 -0
- data/lib/capybara/spec/session/click_button_spec.rb +243 -0
- data/lib/capybara/spec/session/click_link_or_button_spec.rb +30 -0
- data/lib/capybara/spec/session/click_link_spec.rb +108 -0
- data/lib/capybara/spec/session/current_url_spec.rb +15 -0
- data/lib/capybara/spec/session/fill_in_spec.rb +119 -0
- data/lib/capybara/spec/session/find_button_spec.rb +18 -0
- data/lib/capybara/spec/session/find_by_id_spec.rb +18 -0
- data/lib/capybara/spec/session/find_field_spec.rb +26 -0
- data/lib/capybara/spec/session/find_link_spec.rb +19 -0
- data/lib/capybara/spec/session/find_spec.rb +91 -0
- data/lib/capybara/spec/session/has_button_spec.rb +32 -0
- data/lib/capybara/spec/session/has_content_spec.rb +106 -0
- data/lib/capybara/spec/session/has_css_spec.rb +107 -0
- data/lib/capybara/spec/session/has_field_spec.rb +96 -0
- data/lib/capybara/spec/session/has_link_spec.rb +33 -0
- data/lib/capybara/spec/session/has_select_spec.rb +89 -0
- data/lib/capybara/spec/session/has_table_spec.rb +96 -0
- data/lib/capybara/spec/session/has_xpath_spec.rb +123 -0
- data/lib/capybara/spec/session/headers.rb +19 -0
- data/lib/capybara/spec/session/javascript.rb +232 -0
- data/lib/capybara/spec/session/response_code.rb +19 -0
- data/lib/capybara/spec/session/select_spec.rb +91 -0
- data/lib/capybara/spec/session/uncheck_spec.rb +21 -0
- data/lib/capybara/spec/session/unselect_spec.rb +54 -0
- data/lib/capybara/spec/session/within_spec.rb +153 -0
- data/lib/capybara/spec/session.rb +78 -0
- data/lib/capybara/spec/test_app.rb +94 -0
- data/lib/capybara/spec/views/buttons.erb +4 -0
- data/lib/capybara/spec/views/fieldsets.erb +29 -0
- data/lib/capybara/spec/views/form.erb +245 -0
- data/lib/capybara/spec/views/frame_one.erb +8 -0
- data/lib/capybara/spec/views/frame_two.erb +8 -0
- data/lib/capybara/spec/views/postback.erb +13 -0
- data/lib/capybara/spec/views/tables.erb +122 -0
- data/lib/capybara/spec/views/with_html.erb +43 -0
- data/lib/capybara/spec/views/with_js.erb +39 -0
- data/lib/capybara/spec/views/with_scope.erb +36 -0
- data/lib/capybara/spec/views/with_simple_html.erb +1 -0
- data/lib/capybara/spec/views/within_frames.erb +10 -0
- data/lib/capybara/util/save_and_open_page.rb +36 -0
- data/lib/capybara/util/timeout.rb +27 -0
- data/lib/capybara/version.rb +3 -0
- data/lib/capybara/xpath.rb +182 -0
- data/lib/capybara.rb +73 -0
- data/spec/capybara_spec.rb +18 -0
- data/spec/driver/celerity_driver_spec.rb +17 -0
- data/spec/driver/culerity_driver_spec.rb +13 -0
- data/spec/driver/rack_test_driver_spec.rb +19 -0
- data/spec/driver/remote_culerity_driver_spec.rb +24 -0
- data/spec/driver/remote_selenium_driver_spec.rb +19 -0
- data/spec/driver/selenium_driver_spec.rb +13 -0
- data/spec/dsl_spec.rb +140 -0
- data/spec/save_and_open_page_spec.rb +83 -0
- data/spec/server_spec.rb +53 -0
- data/spec/session/celerity_session_spec.rb +28 -0
- data/spec/session/culerity_session_spec.rb +26 -0
- data/spec/session/rack_test_session_spec.rb +34 -0
- data/spec/session/selenium_session_spec.rb +26 -0
- data/spec/spec_helper.rb +23 -0
- data/spec/timeout_spec.rb +28 -0
- data/spec/xpath_spec.rb +173 -0
- metadata +314 -0
@@ -0,0 +1,153 @@
|
|
1
|
+
shared_examples_for "within" do
|
2
|
+
describe '#within' do
|
3
|
+
before do
|
4
|
+
@session.visit('/with_scope')
|
5
|
+
end
|
6
|
+
|
7
|
+
context "with CSS selector" do
|
8
|
+
it "should click links in the given scope" do
|
9
|
+
@session.within(:css, "ul li[contains('With Simple HTML')]") do
|
10
|
+
@session.click_link('Go')
|
11
|
+
end
|
12
|
+
@session.body.should include('Bar')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "with XPath selector" do
|
17
|
+
it "should click links in the given scope" do
|
18
|
+
@session.within(:xpath, "//li[contains(.,'With Simple HTML')]") do
|
19
|
+
@session.click_link('Go')
|
20
|
+
end
|
21
|
+
@session.body.should include('Bar')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "with the default selector" do
|
26
|
+
it "should use XPath" do
|
27
|
+
@session.within("//li[contains(., 'With Simple HTML')]") do
|
28
|
+
@session.click_link('Go')
|
29
|
+
end
|
30
|
+
@session.body.should include('Bar')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "with the default selector set to CSS" do
|
35
|
+
before { Capybara.default_selector = :css }
|
36
|
+
it "should use CSS" do
|
37
|
+
@session.within("ul li[contains('With Simple HTML')]") do
|
38
|
+
@session.click_link('Go')
|
39
|
+
end
|
40
|
+
@session.body.should include('Bar')
|
41
|
+
end
|
42
|
+
after { Capybara.default_selector = :xpath }
|
43
|
+
end
|
44
|
+
|
45
|
+
context "with click_link" do
|
46
|
+
it "should click links in the given scope" do
|
47
|
+
@session.within("//li[contains(.,'With Simple HTML')]") do
|
48
|
+
@session.click_link('Go')
|
49
|
+
end
|
50
|
+
@session.body.should include('Bar')
|
51
|
+
end
|
52
|
+
|
53
|
+
context "with nested scopes" do
|
54
|
+
it "should respect the inner scope" do
|
55
|
+
@session.within("//div[@id='for_bar']") do
|
56
|
+
@session.within(".//li[contains(.,'Bar')]") do
|
57
|
+
@session.click_link('Go')
|
58
|
+
end
|
59
|
+
end
|
60
|
+
@session.body.should include('Another World')
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should respect the outer scope" do
|
64
|
+
@session.within("//div[@id='another_foo']") do
|
65
|
+
@session.within(".//li[contains(.,'With Simple HTML')]") do
|
66
|
+
@session.click_link('Go')
|
67
|
+
end
|
68
|
+
end
|
69
|
+
@session.body.should include('Hello world')
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should raise an error if the scope is not found on the page" do
|
74
|
+
running {
|
75
|
+
@session.within("//div[@id='doesnotexist']") do
|
76
|
+
end
|
77
|
+
}.should raise_error(Capybara::ElementNotFound)
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should restore the scope when an error is raised" do
|
81
|
+
running {
|
82
|
+
@session.within("//div[@id='for_bar']") do
|
83
|
+
running {
|
84
|
+
running {
|
85
|
+
@session.within(".//div[@id='doesnotexist']") do
|
86
|
+
end
|
87
|
+
}.should raise_error(Capybara::ElementNotFound)
|
88
|
+
}.should_not change { @session.has_xpath?(".//div[@id='another_foo']") }.from(false)
|
89
|
+
end
|
90
|
+
}.should_not change { @session.has_xpath?(".//div[@id='another_foo']") }.from(true)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
context "with forms" do
|
95
|
+
it "should fill in a field and click a button" do
|
96
|
+
@session.within("//li[contains(.,'Bar')]") do
|
97
|
+
@session.click_button('Go')
|
98
|
+
end
|
99
|
+
extract_results(@session)['first_name'].should == 'Peter'
|
100
|
+
@session.visit('/with_scope')
|
101
|
+
@session.within("//li[contains(.,'Bar')]") do
|
102
|
+
@session.fill_in('First Name', :with => 'Dagobert')
|
103
|
+
@session.click_button('Go')
|
104
|
+
end
|
105
|
+
extract_results(@session)['first_name'].should == 'Dagobert'
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
describe '#within_fieldset' do
|
111
|
+
before do
|
112
|
+
@session.visit('/fieldsets')
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should restrict scope to a fieldset given by id" do
|
116
|
+
@session.within_fieldset("villain_fieldset") do
|
117
|
+
@session.fill_in("Name", :with => 'Goldfinger')
|
118
|
+
@session.click_button("Create")
|
119
|
+
end
|
120
|
+
extract_results(@session)['villain_name'].should == 'Goldfinger'
|
121
|
+
end
|
122
|
+
|
123
|
+
it "should restrict scope to a fieldset given by legend" do
|
124
|
+
@session.within_fieldset("Villain") do
|
125
|
+
@session.fill_in("Name", :with => 'Goldfinger')
|
126
|
+
@session.click_button("Create")
|
127
|
+
end
|
128
|
+
extract_results(@session)['villain_name'].should == 'Goldfinger'
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
describe '#within_table' do
|
133
|
+
before do
|
134
|
+
@session.visit('/tables')
|
135
|
+
end
|
136
|
+
|
137
|
+
it "should restrict scope to a fieldset given by id" do
|
138
|
+
@session.within_table("girl_table") do
|
139
|
+
@session.fill_in("Name", :with => 'Christmas')
|
140
|
+
@session.click_button("Create")
|
141
|
+
end
|
142
|
+
extract_results(@session)['girl_name'].should == 'Christmas'
|
143
|
+
end
|
144
|
+
|
145
|
+
it "should restrict scope to a fieldset given by legend" do
|
146
|
+
@session.within_table("Villain") do
|
147
|
+
@session.fill_in("Name", :with => 'Quantum')
|
148
|
+
@session.click_button("Create")
|
149
|
+
end
|
150
|
+
extract_results(@session)['villain_name'].should == 'Quantum'
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'capybara/spec/test_app'
|
2
|
+
require 'nokogiri'
|
3
|
+
|
4
|
+
Dir[File.dirname(__FILE__)+'/session/*'].each { |group| require group }
|
5
|
+
|
6
|
+
shared_examples_for "session" do
|
7
|
+
def extract_results(session)
|
8
|
+
YAML.load Nokogiri::HTML(session.body).xpath("//pre[@id='results']").first.text
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '#app' do
|
12
|
+
it "should remember the application" do
|
13
|
+
@session.app.should == TestApp
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#visit' do
|
18
|
+
it "should fetch a response from the driver" do
|
19
|
+
@session.visit('/')
|
20
|
+
@session.body.should include('Hello world!')
|
21
|
+
@session.visit('/foo')
|
22
|
+
@session.body.should include('Another World')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#body' do
|
27
|
+
it "should return the unmodified page body" do
|
28
|
+
@session.visit('/')
|
29
|
+
@session.body.should include('Hello world!')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '#source' do
|
34
|
+
it "should return the unmodified page source" do
|
35
|
+
@session.visit('/')
|
36
|
+
@session.source.should include('Hello world!')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it_should_behave_like "all"
|
41
|
+
it_should_behave_like "attach_file"
|
42
|
+
it_should_behave_like "check"
|
43
|
+
it_should_behave_like "choose"
|
44
|
+
it_should_behave_like "click_link_or_button"
|
45
|
+
it_should_behave_like "click_button"
|
46
|
+
it_should_behave_like "click_link"
|
47
|
+
it_should_behave_like "fill_in"
|
48
|
+
it_should_behave_like "find_button"
|
49
|
+
it_should_behave_like "find_field"
|
50
|
+
it_should_behave_like "find_link"
|
51
|
+
it_should_behave_like "find_by_id"
|
52
|
+
it_should_behave_like "find"
|
53
|
+
it_should_behave_like "has_content"
|
54
|
+
it_should_behave_like "has_css"
|
55
|
+
it_should_behave_like "has_css"
|
56
|
+
it_should_behave_like "has_xpath"
|
57
|
+
it_should_behave_like "has_link"
|
58
|
+
it_should_behave_like "has_button"
|
59
|
+
it_should_behave_like "has_field"
|
60
|
+
it_should_behave_like "has_select"
|
61
|
+
it_should_behave_like "has_table"
|
62
|
+
it_should_behave_like "select"
|
63
|
+
it_should_behave_like "uncheck"
|
64
|
+
it_should_behave_like "unselect"
|
65
|
+
it_should_behave_like "within"
|
66
|
+
it_should_behave_like "current_url"
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
describe Capybara::Session do
|
71
|
+
context 'with non-existant driver' do
|
72
|
+
it "should raise an error" do
|
73
|
+
running {
|
74
|
+
Capybara::Session.new(:quox, TestApp).driver
|
75
|
+
}.should raise_error(Capybara::DriverNotFoundError)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
require 'rack'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
class TestApp < Sinatra::Base
|
6
|
+
set :root, File.dirname(__FILE__)
|
7
|
+
set :static, true
|
8
|
+
|
9
|
+
get '/' do
|
10
|
+
'Hello world!'
|
11
|
+
end
|
12
|
+
|
13
|
+
get '/foo' do
|
14
|
+
'Another World'
|
15
|
+
end
|
16
|
+
|
17
|
+
get '/redirect' do
|
18
|
+
redirect '/redirect_again'
|
19
|
+
end
|
20
|
+
|
21
|
+
get '/redirect_again' do
|
22
|
+
redirect '/landed'
|
23
|
+
end
|
24
|
+
|
25
|
+
get '/redirect/:times/times' do
|
26
|
+
times = params[:times].to_i
|
27
|
+
if times.zero?
|
28
|
+
"redirection complete"
|
29
|
+
else
|
30
|
+
redirect "/redirect/#{times - 1}/times"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
get '/landed' do
|
35
|
+
"You landed"
|
36
|
+
end
|
37
|
+
|
38
|
+
get '/with-quotes' do
|
39
|
+
%q{"No," he said, "you can't do that."}
|
40
|
+
end
|
41
|
+
|
42
|
+
get '/form/get' do
|
43
|
+
'<pre id="results">' + params[:form].to_yaml + '</pre>'
|
44
|
+
end
|
45
|
+
|
46
|
+
get '/favicon.ico' do
|
47
|
+
nil
|
48
|
+
end
|
49
|
+
|
50
|
+
post '/redirect' do
|
51
|
+
redirect '/redirect_again'
|
52
|
+
end
|
53
|
+
|
54
|
+
delete "/delete" do
|
55
|
+
"The requested object was deleted"
|
56
|
+
end
|
57
|
+
|
58
|
+
get '/redirect_back' do
|
59
|
+
redirect back
|
60
|
+
end
|
61
|
+
|
62
|
+
get '/set_cookie' do
|
63
|
+
cookie_value = 'test_cookie'
|
64
|
+
response.set_cookie('capybara', cookie_value)
|
65
|
+
"Cookie set to #{cookie_value}"
|
66
|
+
end
|
67
|
+
|
68
|
+
get '/get_cookie' do
|
69
|
+
request.cookies['capybara']
|
70
|
+
end
|
71
|
+
|
72
|
+
get '/:view' do |view|
|
73
|
+
erb view.to_sym
|
74
|
+
end
|
75
|
+
|
76
|
+
post '/form' do
|
77
|
+
'<pre id="results">' + params[:form].to_yaml + '</pre>'
|
78
|
+
end
|
79
|
+
|
80
|
+
post '/upload' do
|
81
|
+
begin
|
82
|
+
buffer = []
|
83
|
+
buffer << "Content-type: #{params[:form][:document][:type]}"
|
84
|
+
buffer << "File content: #{params[:form][:document][:tempfile].read}"
|
85
|
+
buffer.join(' | ')
|
86
|
+
rescue
|
87
|
+
'No file uploaded'
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
if __FILE__ == $0
|
93
|
+
Rack::Handler::Mongrel.run TestApp, :Port => 8070
|
94
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<form action="/form" method="post">
|
2
|
+
<fieldset id="agent_fieldset">
|
3
|
+
<legend>Agent</legend>
|
4
|
+
|
5
|
+
<p>
|
6
|
+
<label for="form_agent_name">Name</label>
|
7
|
+
<input type="text" name="form[agent_name]" value="James" id="form_agent_name"/>
|
8
|
+
</p>
|
9
|
+
|
10
|
+
<p>
|
11
|
+
<input type="submit" value="Create"/>
|
12
|
+
</p>
|
13
|
+
</fieldset>
|
14
|
+
</form>
|
15
|
+
|
16
|
+
<form action="/form" method="post">
|
17
|
+
<fieldset id="villain_fieldset">
|
18
|
+
<legend>Villain</legend>
|
19
|
+
|
20
|
+
<p>
|
21
|
+
<label for="form_villain_name">Name</label>
|
22
|
+
<input type="text" name="form[villain_name]" value="Ernst" id="form_villain_name"/>
|
23
|
+
</p>
|
24
|
+
|
25
|
+
<p>
|
26
|
+
<input type="submit" value="Create"/>
|
27
|
+
</p>
|
28
|
+
</fieldset>
|
29
|
+
</form>
|
@@ -0,0 +1,245 @@
|
|
1
|
+
<h1>Form</h1>
|
2
|
+
|
3
|
+
<form action="/form" method="post">
|
4
|
+
|
5
|
+
<p>
|
6
|
+
<label for="form_title">Title</label>
|
7
|
+
<select name="form[title]" id="form_title">
|
8
|
+
<option>Mrs</option>
|
9
|
+
<option>Mr</option>
|
10
|
+
<option>Miss</option>
|
11
|
+
</select>
|
12
|
+
</p>
|
13
|
+
|
14
|
+
|
15
|
+
<p>
|
16
|
+
<label for="form_other_title">Other title</label>
|
17
|
+
<select name="form[other_title]" id="form_other_title">
|
18
|
+
<option>Mrs</option>
|
19
|
+
<option>Mr</option>
|
20
|
+
<option>Miss</option>
|
21
|
+
</select>
|
22
|
+
</p>
|
23
|
+
|
24
|
+
<p>
|
25
|
+
<label for="form_first_name">
|
26
|
+
First Name
|
27
|
+
<input type="text" name="form[first_name]" value="John" id="form_first_name"/>
|
28
|
+
</label>
|
29
|
+
</p>
|
30
|
+
|
31
|
+
<p>
|
32
|
+
<label for="form_last_name">Last Name</label>
|
33
|
+
<input type="text" name="form[last_name]" value="Smith" id="form_last_name"/>
|
34
|
+
</p>
|
35
|
+
|
36
|
+
<p>
|
37
|
+
<label for="form_name_explanation">Explanation of Name</label>
|
38
|
+
<textarea name="form[name_explanation]" id="form_name_explanation"></textarea>
|
39
|
+
</p>
|
40
|
+
|
41
|
+
<p>
|
42
|
+
<label for="form_name">Name</label>
|
43
|
+
<input type="text" name="form[name]" value="John Smith" id="form_name"/>
|
44
|
+
</p>
|
45
|
+
|
46
|
+
<p>
|
47
|
+
<label for="form_schmooo">Schmooo</label>
|
48
|
+
<input type="schmooo" name="form[schmooo]" value="This is Schmooo!" id="form_schmooo"/>
|
49
|
+
</p>
|
50
|
+
|
51
|
+
<p>
|
52
|
+
<label>Street<br/>
|
53
|
+
<input type="text" name="form[street]" value="Sesame street 66"/>
|
54
|
+
</label>
|
55
|
+
</p>
|
56
|
+
|
57
|
+
<p>
|
58
|
+
<label for="form_phone">Phone</label>
|
59
|
+
<input name="form[phone]" value="+1 555 7021" id="form_phone"/>
|
60
|
+
</p>
|
61
|
+
|
62
|
+
<p>
|
63
|
+
<label for="form_password">Password</label>
|
64
|
+
<input type="password" name="form[password]" value="seeekrit" id="form_password"/>
|
65
|
+
</p>
|
66
|
+
|
67
|
+
<p>
|
68
|
+
<label for="form_terms_of_use">Terms of Use</label>
|
69
|
+
<input type="hidden" name="form[terms_of_use]" value="0" id="form_terms_of_use_default">
|
70
|
+
<input type="checkbox" name="form[terms_of_use]" value="1" id="form_terms_of_use">
|
71
|
+
</p>
|
72
|
+
|
73
|
+
<p>
|
74
|
+
<label for="form_image">Image</label>
|
75
|
+
<input type="file" name="form[image]" id="form_image"/>
|
76
|
+
</p>
|
77
|
+
|
78
|
+
<p>
|
79
|
+
<input type="hidden" name="form[token]" value="12345" id="form_token"/>
|
80
|
+
</p>
|
81
|
+
|
82
|
+
<p>
|
83
|
+
<label for="form_locale">Locale</label>
|
84
|
+
<select name="form[locale]" id="form_locale">
|
85
|
+
<option value="sv">Swedish</option>
|
86
|
+
<option selected="selected" value="en">English</option>
|
87
|
+
<option value="fi">Finish</option>
|
88
|
+
<option value="no">Norwegian</option>
|
89
|
+
<option value="jo">John's made-up language</option>
|
90
|
+
<option value="jbo"> Lojban </option>
|
91
|
+
</select>
|
92
|
+
</p>
|
93
|
+
|
94
|
+
<p>
|
95
|
+
<label for="form_region">Region</label>
|
96
|
+
<select name="form[region]" id="form_region">
|
97
|
+
<option>Sweden</option>
|
98
|
+
<option selected="selected">Norway</option>
|
99
|
+
<option>Finland</option>
|
100
|
+
</select>
|
101
|
+
</p>
|
102
|
+
|
103
|
+
<p>
|
104
|
+
<label for="form_city">City</label>
|
105
|
+
<select name="form[city]" id="form_city">
|
106
|
+
<option>London</option>
|
107
|
+
<option>Stockholm</option>
|
108
|
+
<option>Paris</option>
|
109
|
+
</select>
|
110
|
+
</p>
|
111
|
+
|
112
|
+
<p>
|
113
|
+
<label for="form_tendency">Tendency</label>
|
114
|
+
<select name="form[tendency]" id="form_tendency"></select>
|
115
|
+
</p>
|
116
|
+
|
117
|
+
<p>
|
118
|
+
<label for="form_description">Description</label></br>
|
119
|
+
<textarea name="form[description]" id="form_description">Descriptive text goes here</textarea>
|
120
|
+
<p>
|
121
|
+
|
122
|
+
<p>
|
123
|
+
<input type="radio" name="form[gender]" value="male" id="gender_male"/>
|
124
|
+
<label for="gender_male">Male</label>
|
125
|
+
<input type="radio" name="form[gender]" value="female" id="gender_female" checked="checked"/>
|
126
|
+
<label for="gender_female">Female</label>
|
127
|
+
<input type="radio" name="form[gender]" value="both" id="gender_both"/>
|
128
|
+
<label for="gender_both">Both</label>
|
129
|
+
</p>
|
130
|
+
|
131
|
+
<p>
|
132
|
+
<input type="checkbox" value="dog" name="form[pets][]" id="form_pets_dog" checked="checked"/>
|
133
|
+
<label for="form_pets_dog">Dog</label>
|
134
|
+
<input type="checkbox" value="cat" name="form[pets][]" id="form_pets_cat"/>
|
135
|
+
<label for="form_pets_cat">Cat</label>
|
136
|
+
<input type="checkbox" value="hamster" name="form[pets][]" id="form_pets_hamster" checked="checked"/>
|
137
|
+
<label for="form_pets_hamster">Hamster</label>
|
138
|
+
</p>
|
139
|
+
|
140
|
+
<p>
|
141
|
+
<label for="form_languages">Languages</label>
|
142
|
+
<select name="form[languages][]" id="form_languages" multiple="multiple">
|
143
|
+
<option>Ruby</option>
|
144
|
+
<option>SQL</option>
|
145
|
+
<option>HTML</option>
|
146
|
+
<option>Javascript</option>
|
147
|
+
</select>
|
148
|
+
</p>
|
149
|
+
|
150
|
+
<p>
|
151
|
+
<label for="form_underwear">Underwear</label>
|
152
|
+
<select name="form[underwear][]" id="form_underwear" multiple="multiple">
|
153
|
+
<option selected="selected">Boxer Briefs</option>
|
154
|
+
<option>Boxers</option>
|
155
|
+
<option selected="selected">Briefs</option>
|
156
|
+
<option selected="selected">Commando</option>
|
157
|
+
<option selected="selected">Frenchman's Pantalons</option>
|
158
|
+
</select>
|
159
|
+
</p>
|
160
|
+
|
161
|
+
<div style="display:none;">
|
162
|
+
<label for="form_first_name_hidden">
|
163
|
+
Super Secret
|
164
|
+
<input type="text" name="form[super_secret]" value="test123" id="form_super_secret"/>
|
165
|
+
</label>
|
166
|
+
</div>
|
167
|
+
|
168
|
+
<p>
|
169
|
+
<input type="button" name="form[fresh]" id="fresh_btn" value="i am fresh"/>
|
170
|
+
<input type="submit" name="form[awesome]" id="awe123" value="awesome"/>
|
171
|
+
<input type="submit" name="form[crappy]" id="crap321" value="crappy"/>
|
172
|
+
<input type="image" name="form[okay]" id="okay556" value="okay" alt="oh hai thar"/>
|
173
|
+
<button type="submit" id="click_me_123" value="click_me">Click me!</button>
|
174
|
+
<button type="submit" name="form[no_value]">No Value!</button>
|
175
|
+
</p>
|
176
|
+
</form>
|
177
|
+
|
178
|
+
<form id="get-form" action="/form/get?foo=bar" method="get">
|
179
|
+
<p>
|
180
|
+
<label for="form_middle_name">Middle Name</label>
|
181
|
+
<input type="text" name="form[middle_name]" value="Darren" id="form_middle_name"/>
|
182
|
+
</p>
|
183
|
+
|
184
|
+
<p>
|
185
|
+
<input type="submit" name="form[mediocre]" id="mediocre" value="med"/>
|
186
|
+
<p>
|
187
|
+
</form>
|
188
|
+
|
189
|
+
<form action="/upload" method="post" enctype="multipart/form-data">
|
190
|
+
<p>
|
191
|
+
<label for="form_file_name">File Name</label>
|
192
|
+
<input type="file" name="form[file_name]" id="form_file_name"/>
|
193
|
+
</p>
|
194
|
+
|
195
|
+
<p>
|
196
|
+
<label for="form_document">Document</label>
|
197
|
+
<input type="file" name="form[document]" id="form_document"/>
|
198
|
+
</p>
|
199
|
+
|
200
|
+
<p>
|
201
|
+
<input type="submit" value="Upload"/>
|
202
|
+
<p>
|
203
|
+
</form>
|
204
|
+
|
205
|
+
<form action="/redirect" method="post">
|
206
|
+
<p>
|
207
|
+
<input type="submit" value="Go FAR"/>
|
208
|
+
</p>
|
209
|
+
</form>
|
210
|
+
|
211
|
+
<form action="/form" method="post">
|
212
|
+
<p>
|
213
|
+
<label for="html5_email">Html5 Email</label>
|
214
|
+
<input type="email" name="form[html5_email]" value="person@email.com" id="html5_email"/>
|
215
|
+
</p>
|
216
|
+
<p>
|
217
|
+
<label for="html5_url">Html5 Url</label>
|
218
|
+
<input type="url" name="form[html5_url]" value="http://www.example.com" id="html5_url"/>
|
219
|
+
</p>
|
220
|
+
<p>
|
221
|
+
<label for="html5_search">Html5 Search</label>
|
222
|
+
<input type="search" name="form[html5_search]" value="what are you looking for" id="html5_search"/>
|
223
|
+
</p>
|
224
|
+
<p>
|
225
|
+
<label for="html5_tel">Html5 Tel</label>
|
226
|
+
<input type="tel" name="form[html5_tel]" value="911" id="html5_tel"/>
|
227
|
+
</p>
|
228
|
+
<p>
|
229
|
+
<label for="html5_color">Html5 Color</label>
|
230
|
+
<input type="color" name="form[html5_color]" value="#FFF" id="html5_color"/>
|
231
|
+
</p>
|
232
|
+
|
233
|
+
<p>
|
234
|
+
<input type="submit" name="form[html5_submit]" value="html5_submit"/>
|
235
|
+
</p>
|
236
|
+
</form>
|
237
|
+
|
238
|
+
<form action="/form" method="post">
|
239
|
+
<p>
|
240
|
+
<button type="submit" name="form[button]" value="button_first">Just an input that came first</button>
|
241
|
+
<button type="submit" name="form[button]" value="button_second">Just an input</button>
|
242
|
+
<input type="submit" name="form[button]" value="Just a button that came first"/>
|
243
|
+
<input type="submit" name="form[button]" value="Just a button"/>
|
244
|
+
</p>
|
245
|
+
</form>
|