rcarvalho-capybara 0.4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +202 -0
- data/README.rdoc +540 -0
- data/lib/capybara.rb +231 -0
- data/lib/capybara/cucumber.rb +32 -0
- data/lib/capybara/driver/base.rb +60 -0
- data/lib/capybara/driver/celerity_driver.rb +164 -0
- data/lib/capybara/driver/culerity_driver.rb +26 -0
- data/lib/capybara/driver/node.rb +78 -0
- data/lib/capybara/driver/rack_test_driver.rb +303 -0
- data/lib/capybara/driver/selenium_driver.rb +165 -0
- data/lib/capybara/dsl.rb +109 -0
- data/lib/capybara/node/actions.rb +160 -0
- data/lib/capybara/node/base.rb +47 -0
- data/lib/capybara/node/document.rb +17 -0
- data/lib/capybara/node/element.rb +182 -0
- data/lib/capybara/node/finders.rb +201 -0
- data/lib/capybara/node/matchers.rb +391 -0
- data/lib/capybara/node/simple.rb +116 -0
- data/lib/capybara/rails.rb +17 -0
- data/lib/capybara/rspec.rb +18 -0
- data/lib/capybara/selector.rb +70 -0
- data/lib/capybara/server.rb +90 -0
- data/lib/capybara/session.rb +281 -0
- data/lib/capybara/spec/driver.rb +243 -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.rb +110 -0
- data/lib/capybara/spec/session/all_spec.rb +78 -0
- data/lib/capybara/spec/session/attach_file_spec.rb +70 -0
- data/lib/capybara/spec/session/check_spec.rb +65 -0
- data/lib/capybara/spec/session/choose_spec.rb +26 -0
- data/lib/capybara/spec/session/click_button_spec.rb +252 -0
- data/lib/capybara/spec/session/click_link_or_button_spec.rb +36 -0
- data/lib/capybara/spec/session/click_link_spec.rb +113 -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 +121 -0
- data/lib/capybara/spec/session/first_spec.rb +72 -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 +213 -0
- data/lib/capybara/spec/session/has_field_spec.rb +156 -0
- data/lib/capybara/spec/session/has_link_spec.rb +37 -0
- data/lib/capybara/spec/session/has_select_spec.rb +129 -0
- data/lib/capybara/spec/session/has_selector_spec.rb +129 -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 +223 -0
- data/lib/capybara/spec/session/response_code.rb +19 -0
- data/lib/capybara/spec/session/select_spec.rb +105 -0
- data/lib/capybara/spec/session/uncheck_spec.rb +21 -0
- data/lib/capybara/spec/session/unselect_spec.rb +61 -0
- data/lib/capybara/spec/session/within_spec.rb +160 -0
- data/lib/capybara/spec/test_app.rb +117 -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 +348 -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/popup_one.erb +8 -0
- data/lib/capybara/spec/views/popup_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 +69 -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/spec/views/within_popups.erb +25 -0
- data/lib/capybara/util/save_and_open_page.rb +40 -0
- data/lib/capybara/util/timeout.rb +27 -0
- data/lib/capybara/version.rb +3 -0
- data/spec/basic_node_spec.rb +77 -0
- data/spec/capybara_spec.rb +46 -0
- data/spec/driver/celerity_driver_spec.rb +13 -0
- data/spec/driver/culerity_driver_spec.rb +14 -0
- data/spec/driver/rack_test_driver_spec.rb +84 -0
- data/spec/driver/remote_culerity_driver_spec.rb +22 -0
- data/spec/driver/remote_selenium_driver_spec.rb +16 -0
- data/spec/driver/selenium_driver_spec.rb +14 -0
- data/spec/dsl_spec.rb +157 -0
- data/spec/rspec_spec.rb +47 -0
- data/spec/save_and_open_page_spec.rb +159 -0
- data/spec/server_spec.rb +85 -0
- data/spec/session/celerity_session_spec.rb +24 -0
- data/spec/session/culerity_session_spec.rb +26 -0
- data/spec/session/rack_test_session_spec.rb +44 -0
- data/spec/session/selenium_session_spec.rb +26 -0
- data/spec/spec_helper.rb +40 -0
- data/spec/string_spec.rb +77 -0
- data/spec/timeout_spec.rb +28 -0
- metadata +343 -0
@@ -0,0 +1,160 @@
|
|
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
|
+
|
15
|
+
it "should accept additional options" do
|
16
|
+
@session.within(:css, "ul li", :text => 'With Simple HTML') do
|
17
|
+
@session.click_link('Go')
|
18
|
+
end
|
19
|
+
@session.body.should include('Bar')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "with XPath selector" do
|
24
|
+
it "should click links in the given scope" do
|
25
|
+
@session.within(:xpath, "//li[contains(.,'With Simple HTML')]") do
|
26
|
+
@session.click_link('Go')
|
27
|
+
end
|
28
|
+
@session.body.should include('Bar')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "with the default selector" do
|
33
|
+
it "should use XPath" do
|
34
|
+
@session.within("//li[contains(., 'With Simple HTML')]") do
|
35
|
+
@session.click_link('Go')
|
36
|
+
end
|
37
|
+
@session.body.should include('Bar')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context "with the default selector set to CSS" do
|
42
|
+
before { Capybara.default_selector = :css }
|
43
|
+
it "should use CSS" do
|
44
|
+
@session.within("ul li[contains('With Simple HTML')]") do
|
45
|
+
@session.click_link('Go')
|
46
|
+
end
|
47
|
+
@session.body.should include('Bar')
|
48
|
+
end
|
49
|
+
after { Capybara.default_selector = :xpath }
|
50
|
+
end
|
51
|
+
|
52
|
+
context "with click_link" do
|
53
|
+
it "should click links in the given scope" do
|
54
|
+
@session.within("//li[contains(.,'With Simple HTML')]") do
|
55
|
+
@session.click_link('Go')
|
56
|
+
end
|
57
|
+
@session.body.should include('Bar')
|
58
|
+
end
|
59
|
+
|
60
|
+
context "with nested scopes" do
|
61
|
+
it "should respect the inner scope" do
|
62
|
+
@session.within("//div[@id='for_bar']") do
|
63
|
+
@session.within(".//li[contains(.,'Bar')]") do
|
64
|
+
@session.click_link('Go')
|
65
|
+
end
|
66
|
+
end
|
67
|
+
@session.body.should include('Another World')
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should respect the outer scope" do
|
71
|
+
@session.within("//div[@id='another_foo']") do
|
72
|
+
@session.within(".//li[contains(.,'With Simple HTML')]") do
|
73
|
+
@session.click_link('Go')
|
74
|
+
end
|
75
|
+
end
|
76
|
+
@session.body.should include('Hello world')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should raise an error if the scope is not found on the page" do
|
81
|
+
running {
|
82
|
+
@session.within("//div[@id='doesnotexist']") do
|
83
|
+
end
|
84
|
+
}.should raise_error(Capybara::ElementNotFound)
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should restore the scope when an error is raised" do
|
88
|
+
running {
|
89
|
+
@session.within("//div[@id='for_bar']") do
|
90
|
+
running {
|
91
|
+
running {
|
92
|
+
@session.within(".//div[@id='doesnotexist']") do
|
93
|
+
end
|
94
|
+
}.should raise_error(Capybara::ElementNotFound)
|
95
|
+
}.should_not change { @session.has_xpath?(".//div[@id='another_foo']") }.from(false)
|
96
|
+
end
|
97
|
+
}.should_not change { @session.has_xpath?(".//div[@id='another_foo']") }.from(true)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
context "with forms" do
|
102
|
+
it "should fill in a field and click a button" do
|
103
|
+
@session.within("//li[contains(.,'Bar')]") do
|
104
|
+
@session.click_button('Go')
|
105
|
+
end
|
106
|
+
extract_results(@session)['first_name'].should == 'Peter'
|
107
|
+
@session.visit('/with_scope')
|
108
|
+
@session.within("//li[contains(.,'Bar')]") do
|
109
|
+
@session.fill_in('First Name', :with => 'Dagobert')
|
110
|
+
@session.click_button('Go')
|
111
|
+
end
|
112
|
+
extract_results(@session)['first_name'].should == 'Dagobert'
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe '#within_fieldset' do
|
118
|
+
before do
|
119
|
+
@session.visit('/fieldsets')
|
120
|
+
end
|
121
|
+
|
122
|
+
it "should restrict scope to a fieldset given by id" do
|
123
|
+
@session.within_fieldset("villain_fieldset") do
|
124
|
+
@session.fill_in("Name", :with => 'Goldfinger')
|
125
|
+
@session.click_button("Create")
|
126
|
+
end
|
127
|
+
extract_results(@session)['villain_name'].should == 'Goldfinger'
|
128
|
+
end
|
129
|
+
|
130
|
+
it "should restrict scope to a fieldset given by legend" do
|
131
|
+
@session.within_fieldset("Villain") do
|
132
|
+
@session.fill_in("Name", :with => 'Goldfinger')
|
133
|
+
@session.click_button("Create")
|
134
|
+
end
|
135
|
+
extract_results(@session)['villain_name'].should == 'Goldfinger'
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
describe '#within_table' do
|
140
|
+
before do
|
141
|
+
@session.visit('/tables')
|
142
|
+
end
|
143
|
+
|
144
|
+
it "should restrict scope to a fieldset given by id" do
|
145
|
+
@session.within_table("girl_table") do
|
146
|
+
@session.fill_in("Name", :with => 'Christmas')
|
147
|
+
@session.click_button("Create")
|
148
|
+
end
|
149
|
+
extract_results(@session)['girl_name'].should == 'Christmas'
|
150
|
+
end
|
151
|
+
|
152
|
+
it "should restrict scope to a fieldset given by legend" do
|
153
|
+
@session.within_table("Villain") do
|
154
|
+
@session.fill_in("Name", :with => 'Quantum')
|
155
|
+
@session.click_button("Create")
|
156
|
+
end
|
157
|
+
extract_results(@session)['villain_name'].should == 'Quantum'
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
@@ -0,0 +1,117 @@
|
|
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 '/get_header' do
|
73
|
+
env['HTTP_FOO']
|
74
|
+
end
|
75
|
+
|
76
|
+
get '/:view' do |view|
|
77
|
+
erb view.to_sym
|
78
|
+
end
|
79
|
+
|
80
|
+
post '/form' do
|
81
|
+
'<pre id="results">' + params[:form].to_yaml + '</pre>'
|
82
|
+
end
|
83
|
+
|
84
|
+
post '/upload_empty' do
|
85
|
+
if params[:form][:file].nil?
|
86
|
+
'Successfully ignored empty file field.'
|
87
|
+
else
|
88
|
+
'Something went wrong.'
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
post '/upload' do
|
93
|
+
begin
|
94
|
+
buffer = []
|
95
|
+
buffer << "Content-type: #{params[:form][:document][:type]}"
|
96
|
+
buffer << "File content: #{params[:form][:document][:tempfile].read}"
|
97
|
+
buffer.join(' | ')
|
98
|
+
rescue
|
99
|
+
'No file uploaded'
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
post '/upload_multiple' do
|
104
|
+
begin
|
105
|
+
buffer = []
|
106
|
+
buffer << "Content-type: #{params[:form][:multiple_documents][0][:type]}"
|
107
|
+
buffer << "File content: #{params[:form][:multiple_documents][0][:tempfile].read}"
|
108
|
+
buffer.join(' | ')
|
109
|
+
rescue
|
110
|
+
'No files uploaded'
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
if __FILE__ == $0
|
116
|
+
Rack::Handler::WEBrick.run TestApp, :Port => 8070
|
117
|
+
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,348 @@
|
|
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
|
+
<option selected="selected" value="thermal">Long Johns</option>
|
159
|
+
</select>
|
160
|
+
</p>
|
161
|
+
|
162
|
+
<p>
|
163
|
+
<span>First address<span>
|
164
|
+
<label for='address1_street'>Street</label>
|
165
|
+
<input type="text" name="form[addresses][][street]" value="" id="address1_street">
|
166
|
+
|
167
|
+
<label for='address1_city'>City</label>
|
168
|
+
<input type="text" name="form[addresses][][city]" value="" id="address1_city">
|
169
|
+
|
170
|
+
<label for='address1_country'>Country</label>
|
171
|
+
<select name="form[addresses][][country]" id="address1_country">
|
172
|
+
<option>France</option>
|
173
|
+
<option>Ukraine</option>
|
174
|
+
</select>
|
175
|
+
</p>
|
176
|
+
|
177
|
+
<p>
|
178
|
+
<span>Second address<span>
|
179
|
+
<label for='address2_street'>Street</label>
|
180
|
+
<input type="text" name="form[addresses][][street]" value="" id="address2_street">
|
181
|
+
|
182
|
+
<label for='address2_city'>City</label>
|
183
|
+
<input type="text" name="form[addresses][][city]" value="" id="address2_city">
|
184
|
+
|
185
|
+
<label for='address2_country'>Country</label>
|
186
|
+
<select name="form[addresses][][country]" id="address2_country">
|
187
|
+
<option>France</option>
|
188
|
+
<option>Ukraine</option>
|
189
|
+
</select>
|
190
|
+
</p>
|
191
|
+
|
192
|
+
<div style="display:none;">
|
193
|
+
<label for="form_first_name_hidden">
|
194
|
+
Super Secret
|
195
|
+
<input type="text" name="form[super_secret]" value="test123" id="form_super_secret"/>
|
196
|
+
</label>
|
197
|
+
</div>
|
198
|
+
|
199
|
+
<p>
|
200
|
+
<label for="form_disabled_text_field">
|
201
|
+
Disabled Text Field
|
202
|
+
<input type="text" name="form[disabled_text_field]" value="Should not see me" id="form_disabled_text_field" disabled="disabled" />
|
203
|
+
</label>
|
204
|
+
</p>
|
205
|
+
|
206
|
+
<p>
|
207
|
+
<label for="form_disabled_textarea">
|
208
|
+
Disabled Textarea
|
209
|
+
<textarea name="form[disabled_textarea]" value="Should not see me" id="form_disabled_textarea" disabled="disabled"></textarea>
|
210
|
+
</label>
|
211
|
+
</p>
|
212
|
+
|
213
|
+
<p>
|
214
|
+
<label for="form_disabled_checkbox">
|
215
|
+
Disabled Checkbox
|
216
|
+
<input type="checkbox" name="form[disabled_checkbox]" value="Should not see me" id="form_disabled_checkbox" checked="checked" disabled="disabled" />
|
217
|
+
</label>
|
218
|
+
</p>
|
219
|
+
|
220
|
+
<p>
|
221
|
+
<label for="form_disabled_radio">
|
222
|
+
Disabled Radio
|
223
|
+
<input type="radio" name="form[disabled_radio]" value="Should not see me" id="form_disabled_radio" checked="checked" disabled="disabled" />
|
224
|
+
</label>
|
225
|
+
</p>
|
226
|
+
|
227
|
+
<p>
|
228
|
+
<label for="form_disabled_select">
|
229
|
+
Disabled Select
|
230
|
+
<select name="form[disabled_select]" id="form_disabled_select" disabled="disabled">
|
231
|
+
<option value="Should not see me" selected="selected">Should not see me</option>
|
232
|
+
</select>
|
233
|
+
</label>
|
234
|
+
</p>
|
235
|
+
|
236
|
+
<p>
|
237
|
+
<label for="form_disabled_file">
|
238
|
+
Disabled File
|
239
|
+
<input type="file" name="form[disabled_file]" value="/should/not/see/me" id="form_disabled_file" disabled="disabled" />
|
240
|
+
</label>
|
241
|
+
</p>
|
242
|
+
|
243
|
+
<p>
|
244
|
+
<input type="button" name="form[fresh]" id="fresh_btn" value="i am fresh"/>
|
245
|
+
<input type="submit" name="form[awesome]" id="awe123" value="awesome"/>
|
246
|
+
<input type="submit" name="form[crappy]" id="crap321" value="crappy"/>
|
247
|
+
<input type="image" name="form[okay]" id="okay556" value="okay" alt="oh hai thar"/>
|
248
|
+
<button type="submit" id="click_me_123" value="click_me">Click me!</button>
|
249
|
+
<button type="submit" name="form[no_value]">No Value!</button>
|
250
|
+
<button id="no_type">No Type!</button>
|
251
|
+
</p>
|
252
|
+
</form>
|
253
|
+
|
254
|
+
<form id="get-form" action="/form/get?foo=bar" method="get">
|
255
|
+
<p>
|
256
|
+
<label for="form_middle_name">Middle Name</label>
|
257
|
+
<input type="text" name="form[middle_name]" value="Darren" id="form_middle_name"/>
|
258
|
+
</p>
|
259
|
+
|
260
|
+
<p>
|
261
|
+
<input type="submit" name="form[mediocre]" id="mediocre" value="med"/>
|
262
|
+
<p>
|
263
|
+
</form>
|
264
|
+
|
265
|
+
<form action="/upload_empty" method="post" enctype="multipart/form-data">
|
266
|
+
<p>
|
267
|
+
<label for="form_file_name">File Name</label>
|
268
|
+
<input type="file" name="form[file]" id="form_file"/>
|
269
|
+
</p>
|
270
|
+
|
271
|
+
<p>
|
272
|
+
<input type="submit" value="Upload Empty"/>
|
273
|
+
<p>
|
274
|
+
</form>
|
275
|
+
|
276
|
+
<form action="/upload" method="post" enctype="multipart/form-data">
|
277
|
+
<p>
|
278
|
+
<label for="form_file_name">File Name</label>
|
279
|
+
<input type="file" name="form[file_name]" id="form_file_name"/>
|
280
|
+
</p>
|
281
|
+
|
282
|
+
<p>
|
283
|
+
<label for="form_document">Document</label>
|
284
|
+
<input type="file" name="form[document]" id="form_document"/>
|
285
|
+
</p>
|
286
|
+
|
287
|
+
<p>
|
288
|
+
<input type="submit" value="Upload"/>
|
289
|
+
<p>
|
290
|
+
</form>
|
291
|
+
|
292
|
+
<form action="/upload_multiple" method="post" enctype="multipart/form-data">
|
293
|
+
<p>
|
294
|
+
<label for="form_multiple_file_name">File Name</label>
|
295
|
+
<input type="file" name="form[multiple_file_name]" id="form_multiple_file_name"/>
|
296
|
+
</p>
|
297
|
+
|
298
|
+
<p>
|
299
|
+
<label for="form_multiple_documents">Multiple Documents</label>
|
300
|
+
<input type="file" name="form[multiple_documents][]" id="form_multiple_documents" multiple />
|
301
|
+
</p>
|
302
|
+
|
303
|
+
<p>
|
304
|
+
<input type="submit" value="Upload Multiple"/>
|
305
|
+
<p>
|
306
|
+
</form>
|
307
|
+
|
308
|
+
<form action="/redirect" method="post">
|
309
|
+
<p>
|
310
|
+
<input type="submit" value="Go FAR"/>
|
311
|
+
</p>
|
312
|
+
</form>
|
313
|
+
|
314
|
+
<form action="/form" method="post">
|
315
|
+
<p>
|
316
|
+
<label for="html5_email">Html5 Email</label>
|
317
|
+
<input type="email" name="form[html5_email]" value="person@email.com" id="html5_email"/>
|
318
|
+
</p>
|
319
|
+
<p>
|
320
|
+
<label for="html5_url">Html5 Url</label>
|
321
|
+
<input type="url" name="form[html5_url]" value="http://www.example.com" id="html5_url"/>
|
322
|
+
</p>
|
323
|
+
<p>
|
324
|
+
<label for="html5_search">Html5 Search</label>
|
325
|
+
<input type="search" name="form[html5_search]" value="what are you looking for" id="html5_search"/>
|
326
|
+
</p>
|
327
|
+
<p>
|
328
|
+
<label for="html5_tel">Html5 Tel</label>
|
329
|
+
<input type="tel" name="form[html5_tel]" value="911" id="html5_tel"/>
|
330
|
+
</p>
|
331
|
+
<p>
|
332
|
+
<label for="html5_color">Html5 Color</label>
|
333
|
+
<input type="color" name="form[html5_color]" value="#FFF" id="html5_color"/>
|
334
|
+
</p>
|
335
|
+
|
336
|
+
<p>
|
337
|
+
<input type="submit" name="form[html5_submit]" value="html5_submit"/>
|
338
|
+
</p>
|
339
|
+
</form>
|
340
|
+
|
341
|
+
<form action="/form" method="post">
|
342
|
+
<p>
|
343
|
+
<button type="submit" name="form[button]" value="button_first">Just an input that came first</button>
|
344
|
+
<button type="submit" name="form[button]" value="button_second">Just an input</button>
|
345
|
+
<input type="submit" name="form[button]" value="Just a button that came first"/>
|
346
|
+
<input type="submit" name="form[button]" value="Just a button"/>
|
347
|
+
</p>
|
348
|
+
</form>
|