speedo-formstrap 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +0 -1
- data/README.md +4 -4
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/speedo-formstrap/form_builder.rb +7 -5
- data/lib/speedo-formstrap/helpers.rb +3 -1
- data/lib/speedo-formstrap/helpers/buttons_helper.rb +13 -9
- data/lib/speedo-formstrap/helpers/fieldset_wrapper.rb +11 -6
- data/lib/speedo-formstrap/helpers/inputs_helper.rb +4 -4
- data/lib/speedo-formstrap/inputs/base.rb +2 -1
- data/lib/speedo-formstrap/inputs/base/choices.rb +12 -23
- data/lib/speedo-formstrap/inputs/base/labelling.rb +16 -6
- data/lib/speedo-formstrap/inputs/base/timeish.rb +5 -12
- data/lib/speedo-formstrap/inputs/base/wrapping.rb +32 -14
- data/lib/speedo-formstrap/inputs/number_input.rb +2 -2
- data/lib/speedo-formstrap/inputs/radio_input.rb +13 -12
- data/lib/speedo-formstrap/inputs/range_input.rb +2 -2
- data/spec/builder/semantic_fields_for_spec.rb +16 -16
- data/spec/helpers/buttons_helper_spec.rb +56 -46
- data/spec/helpers/input_helper_spec.rb +209 -209
- data/spec/helpers/inputs_helper_spec.rb +117 -103
- data/spec/inputs/boolean_input_spec.rb +74 -46
- data/spec/inputs/check_boxes_input_spec.rb +110 -82
- data/spec/inputs/date_input_spec.rb +81 -15
- data/spec/inputs/datetime_input_spec.rb +13 -13
- data/spec/inputs/email_input_spec.rb +34 -6
- data/spec/inputs/file_input_spec.rb +34 -6
- data/spec/inputs/hidden_input_spec.rb +41 -13
- data/spec/inputs/number_input_spec.rb +127 -97
- data/spec/inputs/password_input_spec.rb +34 -6
- data/spec/inputs/phone_input_spec.rb +34 -6
- data/spec/inputs/radio_input_spec.rb +73 -45
- data/spec/inputs/range_input_spec.rb +94 -66
- data/spec/inputs/search_input_spec.rb +33 -6
- data/spec/inputs/select_input_spec.rb +124 -78
- data/spec/inputs/string_input_spec.rb +67 -22
- data/spec/inputs/text_input_spec.rb +42 -15
- data/spec/inputs/time_input_spec.rb +23 -23
- data/spec/inputs/time_zone_input_spec.rb +20 -20
- data/spec/inputs/url_input_spec.rb +34 -6
- data/spec/support/custom_macros.rb +67 -196
- data/spec/support/formtastic_spec_helper.rb +22 -6
- data/speedo-formstrap.gemspec +2 -2
- metadata +17 -17
@@ -8,7 +8,7 @@ describe 'string input' do
|
|
8
8
|
before do
|
9
9
|
@output_buffer = ''
|
10
10
|
mock_everything
|
11
|
-
Formtastic::Helpers::FormHelper.builder =
|
11
|
+
Formtastic::Helpers::FormHelper.builder = FormtasticBootstrap::FormBuilder
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "when object is provided" do
|
@@ -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-wrapper')
|
22
|
+
it_should_have_input_wrapper_with_class("control-group")
|
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.control-group div.controls 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,46 +114,74 @@ 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
|
-
|
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
|
+
|
127
154
|
end
|
128
|
-
|
155
|
+
|
156
|
+
|
129
157
|
describe "when no object is provided" do
|
130
158
|
before do
|
131
159
|
concat(semantic_form_for(:project, :url => 'http://test.host/') do |builder|
|
132
160
|
concat(builder.input(:title, :as => :string))
|
133
161
|
end)
|
134
162
|
end
|
135
|
-
|
163
|
+
|
136
164
|
it_should_have_label_with_text(/Title/)
|
137
165
|
it_should_have_label_for("project_title")
|
138
166
|
it_should_have_input_with_id("project_title")
|
139
167
|
it_should_have_input_with_type(:text)
|
140
168
|
it_should_have_input_with_name("project[title]")
|
141
169
|
end
|
142
|
-
|
170
|
+
|
143
171
|
describe "when size is nil" do
|
144
172
|
before do
|
145
173
|
concat(semantic_form_for(:project, :url => 'http://test.host/') do |builder|
|
146
174
|
concat(builder.input(:title, :as => :string, :input_html => {:size => nil}))
|
147
175
|
end)
|
148
176
|
end
|
149
|
-
|
177
|
+
|
150
178
|
it "should have no size attribute" do
|
151
179
|
output_buffer.should_not have_tag("input[@size]")
|
152
180
|
end
|
153
181
|
end
|
154
|
-
|
182
|
+
|
155
183
|
describe "when required" do
|
156
|
-
|
184
|
+
|
157
185
|
context "and configured to use HTML5 attribute" do
|
158
186
|
it "should add the required attribute to the input's html options" do
|
159
187
|
with_config :use_required_attribute, true do
|
@@ -175,7 +203,24 @@ describe 'string input' do
|
|
175
203
|
end
|
176
204
|
end
|
177
205
|
end
|
178
|
-
|
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
|
179
224
|
end
|
180
225
|
|
181
226
|
end
|
@@ -8,15 +8,15 @@ describe 'text input' do
|
|
8
8
|
before do
|
9
9
|
@output_buffer = ''
|
10
10
|
mock_everything
|
11
|
-
Formtastic::Helpers::FormHelper.builder =
|
11
|
+
Formtastic::Helpers::FormHelper.builder = FormtasticBootstrap::FormBuilder
|
12
12
|
|
13
13
|
concat(semantic_form_for(@new_post) do |builder|
|
14
14
|
concat(builder.input(:body, :as => :text))
|
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-wrapper")
|
19
|
+
it_should_have_input_wrapper_with_class("control-group")
|
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.control-group div.controls 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.control-group div.controls 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.control-group div.controls 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.control-group div.controls 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.control-group div.controls textarea[@rows]")
|
67
67
|
end
|
68
68
|
|
69
69
|
describe "when namespace is provided" do
|
@@ -71,7 +71,7 @@ describe 'text input' do
|
|
71
71
|
before do
|
72
72
|
@output_buffer = ''
|
73
73
|
mock_everything
|
74
|
-
Formtastic::Helpers::FormHelper.builder =
|
74
|
+
Formtastic::Helpers::FormHelper.builder = FormtasticBootstrap::FormBuilder
|
75
75
|
|
76
76
|
concat(semantic_form_for(@new_post, :namespace => 'context2') do |builder|
|
77
77
|
concat(builder.input(:body, :as => :text))
|
@@ -83,10 +83,37 @@ describe 'text input' do
|
|
83
83
|
it_should_have_label_for("context2_post_body")
|
84
84
|
|
85
85
|
end
|
86
|
-
|
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
|
+
|
87
114
|
context "when required" do
|
88
115
|
it "should add the required attribute to the input's html options" do
|
89
|
-
with_config :use_required_attribute, true do
|
116
|
+
with_config :use_required_attribute, true do
|
90
117
|
concat(semantic_form_for(@new_post) do |builder|
|
91
118
|
concat(builder.input(:title, :as => :text, :required => true))
|
92
119
|
end)
|
@@ -119,7 +146,7 @@ describe 'text input' do
|
|
119
146
|
concat(semantic_form_for(@new_post) do |builder|
|
120
147
|
concat(builder.input(:title, :as => :text))
|
121
148
|
end)
|
122
|
-
output_buffer.should have_tag("form div.
|
149
|
+
output_buffer.should have_tag("form div.control-group div.controls textarea[@rows='12']")
|
123
150
|
end
|
124
151
|
end
|
125
152
|
|
@@ -128,7 +155,7 @@ describe 'text input' do
|
|
128
155
|
concat(semantic_form_for(@new_post) do |builder|
|
129
156
|
concat(builder.input(:title, :as => :text))
|
130
157
|
end)
|
131
|
-
output_buffer.should_not have_tag("form div.
|
158
|
+
output_buffer.should_not have_tag("form div.control-group div.controls textarea[@rows]")
|
132
159
|
end
|
133
160
|
|
134
161
|
end
|
@@ -144,7 +171,7 @@ describe 'text input' do
|
|
144
171
|
concat(semantic_form_for(@new_post) do |builder|
|
145
172
|
concat(builder.input(:title, :as => :text))
|
146
173
|
end)
|
147
|
-
output_buffer.should have_tag("form div.
|
174
|
+
output_buffer.should have_tag("form div.control-group div.controls textarea[@cols='10']")
|
148
175
|
end
|
149
176
|
end
|
150
177
|
|
@@ -153,7 +180,7 @@ describe 'text input' do
|
|
153
180
|
concat(semantic_form_for(@new_post) do |builder|
|
154
181
|
concat(builder.input(:title, :as => :text))
|
155
182
|
end)
|
156
|
-
output_buffer.should_not have_tag("form div.
|
183
|
+
output_buffer.should_not have_tag("form div.control-group div.controls textarea[@cols]")
|
157
184
|
end
|
158
185
|
|
159
186
|
end
|
@@ -8,7 +8,7 @@ describe 'time input' do
|
|
8
8
|
before do
|
9
9
|
@output_buffer = ''
|
10
10
|
mock_everything
|
11
|
-
Formtastic::Helpers::FormHelper.builder =
|
11
|
+
Formtastic::Helpers::FormHelper.builder = FormtasticBootstrap::FormBuilder
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "general" do
|
@@ -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-wrapper")
|
72
|
+
it_should_have_input_wrapper_with_class("control-group")
|
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.control-group.time-wrapper label.control-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.control-group.time-wrapper label.control-label[@for="post_publish_at"]')
|
86
|
+
output_buffer.should have_tag('form div.control-group.time-wrapper div.controls 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.control-group.time-wrapper div.controls 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)
|