speedo-formstrap 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -2
- data/Gemfile.lock +42 -40
- data/README.md +8 -15
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/formtastic-bootstrap.gemspec +133 -0
- data/lib/{speedo-formstrap → formtastic-bootstrap}/engine.rb +1 -1
- data/lib/{speedo-formstrap → formtastic-bootstrap}/form_builder.rb +9 -11
- data/lib/{speedo-formstrap → formtastic-bootstrap}/helpers/buttons_helper.rb +10 -14
- data/lib/{speedo-formstrap → formtastic-bootstrap}/helpers/fieldset_wrapper.rb +7 -12
- data/lib/{speedo-formstrap → formtastic-bootstrap}/helpers/input_helper.rb +2 -2
- data/lib/{speedo-formstrap → formtastic-bootstrap}/helpers/inputs_helper.rb +6 -6
- data/lib/{speedo-formstrap → formtastic-bootstrap}/helpers.rb +6 -8
- data/lib/formtastic-bootstrap/inputs/base/choices.rb +49 -0
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/base/errors.rb +1 -1
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/base/hints.rb +1 -1
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/base/html.rb +1 -1
- data/lib/formtastic-bootstrap/inputs/base/labelling.rb +18 -0
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/base/stringish.rb +1 -1
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/base/timeish.rb +13 -6
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/base/wrapping.rb +15 -33
- data/lib/formtastic-bootstrap/inputs/base.rb +22 -0
- data/lib/formtastic-bootstrap/inputs/boolean_input.rb +33 -0
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/check_boxes_input.rb +10 -11
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/date_input.rb +1 -1
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/datetime_input.rb +1 -1
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/email_input.rb +1 -1
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/file_input.rb +1 -1
- data/lib/formtastic-bootstrap/inputs/hidden_input.rb +12 -0
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/number_input.rb +3 -3
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/password_input.rb +1 -1
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/phone_input.rb +1 -1
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/radio_input.rb +13 -14
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/range_input.rb +3 -3
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/search_input.rb +1 -1
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/select_input.rb +1 -1
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/string_input.rb +1 -1
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/text_input.rb +1 -1
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/time_input.rb +1 -1
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/time_zone_input.rb +1 -1
- data/lib/{speedo-formstrap → formtastic-bootstrap}/inputs/url_input.rb +1 -1
- data/lib/formtastic-bootstrap/inputs.rb +29 -0
- data/lib/formtastic-bootstrap.rb +6 -0
- data/spec/builder/errors_spec.rb +214 -0
- data/spec/builder/semantic_fields_for_spec.rb +14 -14
- data/spec/helpers/buttons_helper_spec.rb +45 -55
- data/spec/helpers/input_helper_spec.rb +188 -188
- data/spec/helpers/inputs_helper_spec.rb +102 -116
- data/spec/inputs/boolean_input_spec.rb +44 -72
- data/spec/inputs/check_boxes_input_spec.rb +80 -108
- data/spec/inputs/date_input_spec.rb +14 -80
- data/spec/inputs/datetime_input_spec.rb +12 -12
- data/spec/inputs/email_input_spec.rb +5 -33
- data/spec/inputs/file_input_spec.rb +5 -33
- data/spec/inputs/hidden_input_spec.rb +12 -40
- data/spec/inputs/number_input_spec.rb +96 -126
- data/spec/inputs/password_input_spec.rb +5 -33
- data/spec/inputs/phone_input_spec.rb +5 -33
- data/spec/inputs/radio_input_spec.rb +44 -72
- data/spec/inputs/range_input_spec.rb +65 -93
- data/spec/inputs/search_input_spec.rb +5 -32
- data/spec/inputs/select_input_spec.rb +77 -123
- data/spec/inputs/string_input_spec.rb +21 -66
- data/spec/inputs/text_input_spec.rb +13 -40
- data/spec/inputs/time_input_spec.rb +22 -22
- data/spec/inputs/time_zone_input_spec.rb +17 -17
- data/spec/inputs/url_input_spec.rb +5 -33
- data/spec/spec_helper.rb +1 -1
- data/spec/support/custom_macros.rb +188 -59
- data/spec/support/formtastic_spec_helper.rb +3 -19
- data/vendor/assets/stylesheets/formtastic-bootstrap.css +3 -0
- metadata +62 -74
- data/lib/speedo-formstrap/actions/base.rb +0 -18
- data/lib/speedo-formstrap/actions/button_action.rb +0 -7
- data/lib/speedo-formstrap/actions/input_action.rb +0 -7
- data/lib/speedo-formstrap/actions/link_action.rb +0 -7
- data/lib/speedo-formstrap/actions.rb +0 -4
- data/lib/speedo-formstrap/helpers/action_helper.rb +0 -12
- data/lib/speedo-formstrap/helpers/actions_helper.rb +0 -23
- data/lib/speedo-formstrap/inputs/base/choices.rb +0 -38
- data/lib/speedo-formstrap/inputs/base/labelling.rb +0 -28
- data/lib/speedo-formstrap/inputs/base/numeric.rb +0 -18
- data/lib/speedo-formstrap/inputs/base.rb +0 -23
- data/lib/speedo-formstrap/inputs/boolean_input.rb +0 -29
- data/lib/speedo-formstrap/inputs/hidden_input.rb +0 -14
- data/lib/speedo-formstrap/inputs.rb +0 -29
- data/lib/speedo-formstrap.rb +0 -7
- data/spec/actions/button_action_spec.rb +0 -68
- data/spec/actions/generic_action_spec.rb +0 -486
- data/spec/actions/input_action_spec.rb +0 -64
- data/spec/actions/link_action_spec.rb +0 -93
- data/spec/helpers/action_helper_spec.rb +0 -365
- data/spec/helpers/actions_helper_spec.rb +0 -143
- data/speedo-formstrap.gemspec +0 -145
@@ -18,8 +18,8 @@ describe 'string input' do
|
|
18
18
|
end)
|
19
19
|
end
|
20
20
|
|
21
|
-
it_should_have_input_wrapper_with_class(
|
22
|
-
it_should_have_input_wrapper_with_class(
|
21
|
+
it_should_have_input_wrapper_with_class(:string)
|
22
|
+
it_should_have_input_wrapper_with_class(:clearfix)
|
23
23
|
it_should_have_input_wrapper_with_class(:stringish)
|
24
24
|
it_should_have_input_class_in_the_right_place
|
25
25
|
it_should_have_input_wrapper_with_id("post_title_input")
|
@@ -34,7 +34,7 @@ describe 'string input' do
|
|
34
34
|
it_should_apply_custom_input_attributes_when_input_html_provided(:string)
|
35
35
|
it_should_apply_custom_for_to_label_when_input_html_id_provided(:string)
|
36
36
|
it_should_apply_error_logic_for_input_type(:string)
|
37
|
-
|
37
|
+
|
38
38
|
def input_field_for_method_should_have_maxlength(method, maxlength)
|
39
39
|
concat(semantic_form_for(@new_post) do |builder|
|
40
40
|
concat(builder.input(method))
|
@@ -63,30 +63,30 @@ describe 'string input' do
|
|
63
63
|
concat(builder.input(:title))
|
64
64
|
end)
|
65
65
|
|
66
|
-
output_buffer.should have_tag("form div.
|
66
|
+
output_buffer.should have_tag("form div.clearfix div.input input##{@new_post.class.name.underscore}_title[@maxlength='#{maxlength}']")
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'should have maxlength if the optional :if or :unless options are not supplied' do
|
70
70
|
should_have_maxlength(42, :options => {:maximum => 42})
|
71
71
|
end
|
72
|
-
|
72
|
+
|
73
73
|
it 'should have default maxlength if the optional :if condition is not satisifed' do
|
74
74
|
should_have_maxlength(default_maxlength, :options => {:maximum => 42, :if => false})
|
75
75
|
end
|
76
|
-
|
76
|
+
|
77
77
|
it 'should have default_maxlength if the optional :if proc evaluates to false' do
|
78
78
|
should_have_maxlength(default_maxlength, :options => {:maximum => 42, :if => proc { |record| false }})
|
79
79
|
end
|
80
|
-
|
80
|
+
|
81
81
|
it 'should have maxlength if the optional :if proc evaluates to true' do
|
82
82
|
should_have_maxlength(42, :options => { :maximum => 42, :if => proc { |record| true } })
|
83
83
|
end
|
84
|
-
|
84
|
+
|
85
85
|
it 'should have default maxlength if the optional :if with a method name evaluates to false' do
|
86
86
|
@new_post.should_receive(:specify_maxlength).at_least(1).and_return(false)
|
87
87
|
should_have_maxlength(default_maxlength, :options => { :maximum => 42, :if => :specify_maxlength })
|
88
88
|
end
|
89
|
-
|
89
|
+
|
90
90
|
it 'should have maxlength if the optional :if with a method name evaluates to true' do
|
91
91
|
@new_post.should_receive(:specify_maxlength).at_least(1).and_return(true)
|
92
92
|
should_have_maxlength(42, :options => { :maximum => 42, :if => :specify_maxlength })
|
@@ -99,12 +99,12 @@ describe 'string input' do
|
|
99
99
|
it 'should have maxlength if the optional :unless proc evaluates to false' do
|
100
100
|
should_have_maxlength(42, :options => { :maximum => 42, :unless => proc { |record| false } })
|
101
101
|
end
|
102
|
-
|
102
|
+
|
103
103
|
it 'should have default maxlength if the optional :unless with a method name evaluates to true' do
|
104
104
|
@new_post.should_receive(:specify_maxlength).at_least(1).and_return(true)
|
105
105
|
should_have_maxlength(default_maxlength, :options => { :maximum => 42, :unless => :specify_maxlength })
|
106
106
|
end
|
107
|
-
|
107
|
+
|
108
108
|
it 'should have maxlength if the optional :unless with a method name evaluates to false' do
|
109
109
|
@new_post.should_receive(:specify_maxlength).at_least(1).and_return(false)
|
110
110
|
should_have_maxlength(42, :options => { :maximum => 42, :unless => :specify_maxlength })
|
@@ -114,74 +114,46 @@ describe 'string input' do
|
|
114
114
|
end
|
115
115
|
|
116
116
|
describe "when namespace is provided" do
|
117
|
-
|
117
|
+
|
118
118
|
before do
|
119
119
|
concat(semantic_form_for(@new_post, :namespace => 'context2') do |builder|
|
120
120
|
concat(builder.input(:title, :as => :string))
|
121
121
|
end)
|
122
122
|
end
|
123
|
-
|
123
|
+
|
124
124
|
it_should_have_input_wrapper_with_id("context2_post_title_input")
|
125
125
|
it_should_have_label_and_input_with_id("context2_post_title")
|
126
|
-
|
127
|
-
end
|
128
|
-
|
129
|
-
describe "when index is provided" do
|
130
|
-
|
131
|
-
before do
|
132
|
-
@output_buffer = ''
|
133
|
-
mock_everything
|
134
|
-
|
135
|
-
concat(semantic_form_for(@new_post) do |builder|
|
136
|
-
concat(builder.fields_for(:author, :index => 3) do |author|
|
137
|
-
concat(author.input(:name, :as => :string))
|
138
|
-
end)
|
139
|
-
end)
|
140
|
-
end
|
141
|
-
|
142
|
-
it 'should index the id of the wrapper' do
|
143
|
-
output_buffer.should have_tag("div#post_author_attributes_3_name_input")
|
144
|
-
end
|
145
|
-
|
146
|
-
it 'should index the id of the select tag' do
|
147
|
-
output_buffer.should have_tag("input#post_author_attributes_3_name")
|
148
|
-
end
|
149
|
-
|
150
|
-
it 'should index the name of the select tag' do
|
151
|
-
output_buffer.should have_tag("input[@name='post[author_attributes][3][name]']")
|
152
|
-
end
|
153
|
-
|
126
|
+
|
154
127
|
end
|
155
|
-
|
156
|
-
|
128
|
+
|
157
129
|
describe "when no object is provided" do
|
158
130
|
before do
|
159
131
|
concat(semantic_form_for(:project, :url => 'http://test.host/') do |builder|
|
160
132
|
concat(builder.input(:title, :as => :string))
|
161
133
|
end)
|
162
134
|
end
|
163
|
-
|
135
|
+
|
164
136
|
it_should_have_label_with_text(/Title/)
|
165
137
|
it_should_have_label_for("project_title")
|
166
138
|
it_should_have_input_with_id("project_title")
|
167
139
|
it_should_have_input_with_type(:text)
|
168
140
|
it_should_have_input_with_name("project[title]")
|
169
141
|
end
|
170
|
-
|
142
|
+
|
171
143
|
describe "when size is nil" do
|
172
144
|
before do
|
173
145
|
concat(semantic_form_for(:project, :url => 'http://test.host/') do |builder|
|
174
146
|
concat(builder.input(:title, :as => :string, :input_html => {:size => nil}))
|
175
147
|
end)
|
176
148
|
end
|
177
|
-
|
149
|
+
|
178
150
|
it "should have no size attribute" do
|
179
151
|
output_buffer.should_not have_tag("input[@size]")
|
180
152
|
end
|
181
153
|
end
|
182
|
-
|
154
|
+
|
183
155
|
describe "when required" do
|
184
|
-
|
156
|
+
|
185
157
|
context "and configured to use HTML5 attribute" do
|
186
158
|
it "should add the required attribute to the input's html options" do
|
187
159
|
with_config :use_required_attribute, true do
|
@@ -203,24 +175,7 @@ describe 'string input' do
|
|
203
175
|
end
|
204
176
|
end
|
205
177
|
end
|
206
|
-
|
207
|
-
end
|
208
|
-
|
209
|
-
describe "with string prepended", :now => true do
|
210
|
-
|
211
|
-
before do
|
212
|
-
concat(semantic_form_for(:user) do |builder|
|
213
|
-
concat(builder.input(:handle, :as => :string, :prepend => '@'))
|
214
|
-
end)
|
215
|
-
end
|
216
|
-
|
217
|
-
it "should generate span with desired prepend string" do
|
218
|
-
output_buffer.should have_tag('form div.control-group div.controls div.input-prepend span.add-on', '@')
|
219
|
-
end
|
220
|
-
|
221
|
-
it "should wrap input in div.input-prepend" do
|
222
|
-
output_buffer.should have_tag('form div.control-group div.controls div.input-prepend input[name="user[handle]"]')
|
223
|
-
end
|
178
|
+
|
224
179
|
end
|
225
180
|
|
226
181
|
end
|
@@ -15,8 +15,8 @@ describe 'text input' do
|
|
15
15
|
end)
|
16
16
|
end
|
17
17
|
|
18
|
-
it_should_have_input_wrapper_with_class("text
|
19
|
-
it_should_have_input_wrapper_with_class(
|
18
|
+
it_should_have_input_wrapper_with_class("text")
|
19
|
+
it_should_have_input_wrapper_with_class(:clearfix)
|
20
20
|
it_should_have_input_class_in_the_right_place
|
21
21
|
it_should_have_input_wrapper_with_id("post_body_input")
|
22
22
|
it_should_have_label_with_text(/Body/)
|
@@ -30,7 +30,7 @@ describe 'text input' do
|
|
30
30
|
concat(semantic_form_for(@new_post) do |builder|
|
31
31
|
concat(builder.input(:title, :as => :text, :input_html => { :class => 'myclass' }))
|
32
32
|
end)
|
33
|
-
output_buffer.should have_tag("form div.
|
33
|
+
output_buffer.should have_tag("form div.clearfix div.input textarea.myclass")
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should have a cols attribute when :cols is a number in :input_html" do
|
@@ -38,7 +38,7 @@ describe 'text input' do
|
|
38
38
|
concat(semantic_form_for(@new_post) do |builder|
|
39
39
|
concat(builder.input(:title, :as => :text, :input_html => { :cols => 42 }))
|
40
40
|
end)
|
41
|
-
output_buffer.should have_tag("form div.
|
41
|
+
output_buffer.should have_tag("form div.clearfix div.input textarea[@cols='42']")
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should not have a cols attribute when :cols is nil in :input_html" do
|
@@ -46,7 +46,7 @@ describe 'text input' do
|
|
46
46
|
concat(semantic_form_for(@new_post) do |builder|
|
47
47
|
concat(builder.input(:title, :as => :text, :input_html => { :cols => nil }))
|
48
48
|
end)
|
49
|
-
output_buffer.should_not have_tag("form div.
|
49
|
+
output_buffer.should_not have_tag("form div.clearfix div.input textarea[@cols]")
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should have a rows attribute when :rows is a number in :input_html" do
|
@@ -54,7 +54,7 @@ describe 'text input' do
|
|
54
54
|
concat(semantic_form_for(@new_post) do |builder|
|
55
55
|
concat(builder.input(:title, :as => :text, :input_html => { :rows => 42 }))
|
56
56
|
end)
|
57
|
-
output_buffer.should have_tag("form div.
|
57
|
+
output_buffer.should have_tag("form div.clearfix div.input textarea[@rows='42']")
|
58
58
|
|
59
59
|
end
|
60
60
|
|
@@ -63,7 +63,7 @@ describe 'text input' do
|
|
63
63
|
concat(semantic_form_for(@new_post) do |builder|
|
64
64
|
concat(builder.input(:title, :as => :text, :input_html => { :rows => nil }))
|
65
65
|
end)
|
66
|
-
output_buffer.should_not have_tag("form div.
|
66
|
+
output_buffer.should_not have_tag("form div.clearfix div.input textarea[@rows]")
|
67
67
|
end
|
68
68
|
|
69
69
|
describe "when namespace is provided" do
|
@@ -83,37 +83,10 @@ describe 'text input' do
|
|
83
83
|
it_should_have_label_for("context2_post_body")
|
84
84
|
|
85
85
|
end
|
86
|
-
|
87
|
-
describe "when index is provided" do
|
88
|
-
|
89
|
-
before do
|
90
|
-
@output_buffer = ''
|
91
|
-
mock_everything
|
92
|
-
|
93
|
-
concat(semantic_form_for(@new_post) do |builder|
|
94
|
-
concat(builder.fields_for(:author, :index => 3) do |author|
|
95
|
-
concat(author.input(:name, :as => :text))
|
96
|
-
end)
|
97
|
-
end)
|
98
|
-
end
|
99
|
-
|
100
|
-
it 'should index the id of the wrapper' do
|
101
|
-
output_buffer.should have_tag("div#post_author_attributes_3_name_input")
|
102
|
-
end
|
103
|
-
|
104
|
-
it 'should index the id of the select tag' do
|
105
|
-
output_buffer.should have_tag("textarea#post_author_attributes_3_name")
|
106
|
-
end
|
107
|
-
|
108
|
-
it 'should index the name of the select tag' do
|
109
|
-
output_buffer.should have_tag("textarea[@name='post[author_attributes][3][name]']")
|
110
|
-
end
|
111
|
-
|
112
|
-
end
|
113
|
-
|
86
|
+
|
114
87
|
context "when required" do
|
115
88
|
it "should add the required attribute to the input's html options" do
|
116
|
-
with_config :use_required_attribute, true do
|
89
|
+
with_config :use_required_attribute, true do
|
117
90
|
concat(semantic_form_for(@new_post) do |builder|
|
118
91
|
concat(builder.input(:title, :as => :text, :required => true))
|
119
92
|
end)
|
@@ -146,7 +119,7 @@ describe 'text input' do
|
|
146
119
|
concat(semantic_form_for(@new_post) do |builder|
|
147
120
|
concat(builder.input(:title, :as => :text))
|
148
121
|
end)
|
149
|
-
output_buffer.should have_tag("form div.
|
122
|
+
output_buffer.should have_tag("form div.clearfix div.input textarea[@rows='12']")
|
150
123
|
end
|
151
124
|
end
|
152
125
|
|
@@ -155,7 +128,7 @@ describe 'text input' do
|
|
155
128
|
concat(semantic_form_for(@new_post) do |builder|
|
156
129
|
concat(builder.input(:title, :as => :text))
|
157
130
|
end)
|
158
|
-
output_buffer.should_not have_tag("form div.
|
131
|
+
output_buffer.should_not have_tag("form div.clearfix div.input textarea[@rows]")
|
159
132
|
end
|
160
133
|
|
161
134
|
end
|
@@ -171,7 +144,7 @@ describe 'text input' do
|
|
171
144
|
concat(semantic_form_for(@new_post) do |builder|
|
172
145
|
concat(builder.input(:title, :as => :text))
|
173
146
|
end)
|
174
|
-
output_buffer.should have_tag("form div.
|
147
|
+
output_buffer.should have_tag("form div.clearfix div.input textarea[@cols='10']")
|
175
148
|
end
|
176
149
|
end
|
177
150
|
|
@@ -180,7 +153,7 @@ describe 'text input' do
|
|
180
153
|
concat(semantic_form_for(@new_post) do |builder|
|
181
154
|
concat(builder.input(:title, :as => :text))
|
182
155
|
end)
|
183
|
-
output_buffer.should_not have_tag("form div.
|
156
|
+
output_buffer.should_not have_tag("form div.clearfix div.input textarea[@cols]")
|
184
157
|
end
|
185
158
|
|
186
159
|
end
|
@@ -23,20 +23,20 @@ describe 'time input' do
|
|
23
23
|
# concat(builder.input(:publish_at, :as => :time, :ignore_date => true))
|
24
24
|
# end)
|
25
25
|
# end
|
26
|
-
#
|
26
|
+
#
|
27
27
|
# it 'should not have hidden inputs for day, month and year' do
|
28
28
|
# output_buffer.should_not have_tag('input#post_publish_at_1i')
|
29
29
|
# output_buffer.should_not have_tag('input#post_publish_at_2i')
|
30
30
|
# output_buffer.should_not have_tag('input#post_publish_at_3i')
|
31
31
|
# end
|
32
|
-
#
|
32
|
+
#
|
33
33
|
# it 'should have an input for hour and minute' do
|
34
34
|
# output_buffer.should have_tag('select#post_publish_at_4i')
|
35
35
|
# output_buffer.should have_tag('select#post_publish_at_5i')
|
36
36
|
# end
|
37
|
-
#
|
37
|
+
#
|
38
38
|
# end
|
39
|
-
#
|
39
|
+
#
|
40
40
|
# describe "with :ignore_date => false" do
|
41
41
|
# before do
|
42
42
|
# @new_post.stub(:publish_at).and_return(Time.parse('2010-11-07'))
|
@@ -44,7 +44,7 @@ describe 'time input' do
|
|
44
44
|
# concat(builder.input(:publish_at, :as => :time, :ignore_date => false))
|
45
45
|
# end)
|
46
46
|
# end
|
47
|
-
#
|
47
|
+
#
|
48
48
|
# it 'should have a hidden input for day, month and year' do
|
49
49
|
# output_buffer.should have_tag('input#post_publish_at_1i')
|
50
50
|
# output_buffer.should have_tag('input#post_publish_at_2i')
|
@@ -53,12 +53,12 @@ describe 'time input' do
|
|
53
53
|
# output_buffer.should have_tag('input#post_publish_at_2i[@value="11"]')
|
54
54
|
# output_buffer.should have_tag('input#post_publish_at_3i[@value="7"]')
|
55
55
|
# end
|
56
|
-
#
|
56
|
+
#
|
57
57
|
# it 'should have an select for hour and minute' do
|
58
58
|
# output_buffer.should have_tag('select#post_publish_at_4i')
|
59
59
|
# output_buffer.should have_tag('select#post_publish_at_5i')
|
60
60
|
# end
|
61
|
-
#
|
61
|
+
#
|
62
62
|
# end
|
63
63
|
|
64
64
|
describe "without seconds" do
|
@@ -68,8 +68,8 @@ describe 'time input' do
|
|
68
68
|
end)
|
69
69
|
end
|
70
70
|
|
71
|
-
it_should_have_input_wrapper_with_class("time
|
72
|
-
it_should_have_input_wrapper_with_class(
|
71
|
+
it_should_have_input_wrapper_with_class("time")
|
72
|
+
it_should_have_input_wrapper_with_class(:clearfix)
|
73
73
|
it_should_have_input_wrapper_with_class(:stringish)
|
74
74
|
it_should_have_input_class_in_the_right_place
|
75
75
|
it_should_have_input_wrapper_with_id("post_publish_at_input")
|
@@ -77,17 +77,17 @@ describe 'time input' do
|
|
77
77
|
it_should_apply_error_logic_for_input_type(:time)
|
78
78
|
|
79
79
|
it 'should have a legend and label with the label text inside the fieldset' do
|
80
|
-
output_buffer.should have_tag('form div.
|
80
|
+
output_buffer.should have_tag('form div.clearfix.time label', /Publish at/)
|
81
81
|
end
|
82
82
|
|
83
83
|
# TODO Is this right?
|
84
84
|
it 'should (sort of) associate the label with the input' do
|
85
|
-
output_buffer.should have_tag('form div.
|
86
|
-
output_buffer.should have_tag('form div.
|
85
|
+
output_buffer.should have_tag('form div.clearfix.time label[@for="post_publish_at"]')
|
86
|
+
output_buffer.should have_tag('form div.clearfix.time div.input input[@id="post_publish_at[time]"]')
|
87
87
|
end
|
88
88
|
|
89
89
|
it 'should have an text input inside the div' do
|
90
|
-
output_buffer.should have_tag('form div.
|
90
|
+
output_buffer.should have_tag('form div.clearfix.time div.input input[@type="text"]')
|
91
91
|
end
|
92
92
|
|
93
93
|
# it 'should have five labels for hour and minute' do
|
@@ -95,7 +95,7 @@ describe 'time input' do
|
|
95
95
|
# output_buffer.should have_tag('form li.time fieldset ol li label', /hour/i)
|
96
96
|
# output_buffer.should have_tag('form li.time fieldset ol li label', /minute/i)
|
97
97
|
# end
|
98
|
-
#
|
98
|
+
#
|
99
99
|
# it 'should have two selects for hour and minute' do
|
100
100
|
# output_buffer.should have_tag('form li.time fieldset ol li', :count => 2)
|
101
101
|
# end
|
@@ -127,7 +127,7 @@ describe 'time input' do
|
|
127
127
|
# end
|
128
128
|
end
|
129
129
|
end
|
130
|
-
|
130
|
+
|
131
131
|
# Ignore these since we only create the main label.
|
132
132
|
|
133
133
|
# describe ':labels option' do
|
@@ -143,7 +143,7 @@ describe 'time input' do
|
|
143
143
|
# output_buffer.should have_tag('form li.time fieldset ol li label', f == field ? /another #{f} label/i : /#{f}/i)
|
144
144
|
# end
|
145
145
|
# end
|
146
|
-
#
|
146
|
+
#
|
147
147
|
# it "should not display the label for the #{field} field when :labels[:#{field}] is blank" do
|
148
148
|
# output_buffer.replace ''
|
149
149
|
# concat(semantic_form_for(@new_post) do |builder|
|
@@ -154,8 +154,8 @@ describe 'time input' do
|
|
154
154
|
# output_buffer.should have_tag('form li.time fieldset ol li label', /#{f}/i) unless field == f
|
155
155
|
# end
|
156
156
|
# end
|
157
|
-
#
|
158
|
-
# it "should not render the label when :labels[:#{field}] is false" do
|
157
|
+
#
|
158
|
+
# it "should not render the label when :labels[:#{field}] is false" do
|
159
159
|
# output_buffer.replace ''
|
160
160
|
# concat(semantic_form_for(@new_post) do |builder|
|
161
161
|
# concat(builder.input(:created_at, :as => :time, :include_seconds => true, :labels => { field => false }))
|
@@ -165,15 +165,15 @@ describe 'time input' do
|
|
165
165
|
# output_buffer.should have_tag('form li.time fieldset ol li label', /#{f}/i) unless field == f
|
166
166
|
# end
|
167
167
|
# end
|
168
|
-
#
|
169
|
-
# it "should not render unsafe HTML when :labels[:#{field}] is false" do
|
168
|
+
#
|
169
|
+
# it "should not render unsafe HTML when :labels[:#{field}] is false" do
|
170
170
|
# output_buffer.replace ''
|
171
171
|
# concat(semantic_form_for(@new_post) do |builder|
|
172
172
|
# concat(builder.input(:created_at, :as => :time, :include_seconds => true, :labels => { field => false }))
|
173
173
|
# end)
|
174
174
|
# output_buffer.should_not include(">")
|
175
175
|
# end
|
176
|
-
#
|
176
|
+
#
|
177
177
|
# end
|
178
178
|
# end
|
179
179
|
|
@@ -192,7 +192,7 @@ describe 'time input' do
|
|
192
192
|
|
193
193
|
describe "when required" do
|
194
194
|
it "should add the required attribute to the input's html options" do
|
195
|
-
with_config :use_required_attribute, true do
|
195
|
+
with_config :use_required_attribute, true do
|
196
196
|
concat(semantic_form_for(@new_post) do |builder|
|
197
197
|
concat(builder.input(:title, :as => :time, :required => true))
|
198
198
|
end)
|