@@ -171,6 +171,24 @@ def filter(name, options = {})
171
171
it "should generate a date less than" do
172
172
expect ( body ) . to have_selector ( "input.datepicker[name='q[published_date_lteq]']" )
173
173
end
174
+
175
+ context "with input_html" do
176
+ let ( :body ) { filter :published_date , input_html : { 'autocomplete' : 'off' } }
177
+
178
+ it "should generate provided input html for both ends of date range" do
179
+ expect ( body ) . to have_selector ( "input.datepicker[name='q[published_date_gteq]'][autocomplete=off]" )
180
+ expect ( body ) . to have_selector ( "input.datepicker[name='q[published_date_lteq]'][autocomplete=off]" )
181
+ end
182
+ end
183
+
184
+ context "with input_html overriding the defaults" do
185
+ let ( :body ) { filter :published_date , input_html : { 'class' : 'custom_class' } }
186
+
187
+ it "should override the default attribute values for both ends of date range" do
188
+ expect ( body ) . to have_selector ( "input.custom_class[name='q[published_date_gteq]']" )
189
+ expect ( body ) . to have_selector ( "input.custom_class[name='q[published_date_lteq]']" )
190
+ end
191
+ end
174
192
end
175
193
176
194
describe "datetime attribute" do
@@ -182,6 +200,24 @@ def filter(name, options = {})
182
200
it "should generate a date less than" do
183
201
expect ( body ) . to have_selector ( "input.datepicker[name='q[created_at_lteq_datetime]']" )
184
202
end
203
+
204
+ context "with input_html" do
205
+ let ( :body ) { filter :created_at , input_html : { 'autocomplete' : 'off' } }
206
+
207
+ it "should generate provided input html for both ends of date range" do
208
+ expect ( body ) . to have_selector ( "input.datepicker[name='q[created_at_gteq_datetime]'][autocomplete=off]" )
209
+ expect ( body ) . to have_selector ( "input.datepicker[name='q[created_at_lteq_datetime]'][autocomplete=off]" )
210
+ end
211
+ end
212
+
213
+ context "with input_html overriding the defaults" do
214
+ let ( :body ) { filter :created_at , input_html : { 'class' : 'custom_class' } }
215
+
216
+ it "should override the default attribute values for both ends of date range" do
217
+ expect ( body ) . to have_selector ( "input.custom_class[name='q[created_at_gteq_datetime]']" )
218
+ expect ( body ) . to have_selector ( "input.custom_class[name='q[created_at_lteq_datetime]']" )
219
+ end
220
+ end
185
221
end
186
222
187
223
describe "integer attribute" do
0 commit comments