@@ -260,12 +260,12 @@ class MyTemplate
260260 end
261261 context "with enum filter type" do
262262 let ( :_filter ) { :category }
263+ let ( :_category_filter_options ) { { } }
263264 let ( :_grid ) {
265+ filter_options = _category_filter_options
264266 test_report do
265267 scope { Entry }
266- filter ( :category , :enum , :select => [ "first" , "second" ] )
267- filter ( :category_without_include_blank , :enum , :select => [ "first" , "second" ] , :include_blank => false )
268- filter ( :category_with_prompt , :enum , :select => [ "first" , "second" ] , :prompt => "My Prompt" )
268+ filter ( :category , :enum , select : [ "first" , "second" ] , **filter_options )
269269 end
270270 }
271271 it { should equal_to_dom (
@@ -299,21 +299,15 @@ class MyTemplate
299299 ) }
300300 end
301301 context "with include_blank option set to false" do
302- let ( :_filter ) { :category_without_include_blank }
302+ let ( :_category_filter_options ) { { include_blank : false } }
303303 it { should equal_to_dom (
304- '<select class="category_without_include_blank enum_filter" name="report[category_without_include_blank ]" id="report_category_without_include_blank ">
304+ '<select class="category enum_filter" name="report[category ]" id="report_category ">
305305 <option value="first">first</option>
306306 <option value="second">second</option></select>'
307307 ) }
308308 end
309309 context "with dynamic include_blank option" do
310- let ( :_grid ) do
311- test_report do
312- scope { Entry }
313- filter ( :category , :enum , :select => [ "first" , "second" ] , :include_blank => proc { "Choose plz" } )
314- end
315- end
316- let ( :_filter ) { :category }
310+ let ( :_category_filter_options ) { { include_blank : proc { "Choose plz" } } }
317311 it { should equal_to_dom (
318312 '<select class="category enum_filter" name="report[category]" id="report_category">
319313 <option value="">Choose plz</option>
@@ -323,21 +317,24 @@ class MyTemplate
323317 end
324318
325319 context "with prompt option" do
326- let ( :_filter ) { :category_with_prompt }
320+ let ( :_category_filter_options ) { { prompt : 'My Prompt' } }
327321 it { should equal_to_dom (
328- '<select class="category_with_prompt enum_filter" name="report[category_with_prompt]" id="report_category_with_prompt"><option value="">My Prompt</option>
322+ '<select class="category enum_filter" name="report[category]" id="report_category"><option value="">My Prompt</option>
323+ <option value="first">first</option>
324+ <option value="second">second</option></select>'
325+ ) }
326+ end
327+
328+ context "with input_options class" do
329+ let ( :_category_filter_options ) { { input_options : { class : 'custom-class' } } }
330+ it { should equal_to_dom (
331+ '<select class="custom-class category enum_filter" name="report[category]" id="report_category"><option value="" label=" "></option>
329332 <option value="first">first</option>
330333 <option value="second">second</option></select>'
331334 ) }
332335 end
333336 context "with checkboxes option" do
334- let ( :_grid ) do
335- test_report do
336- scope { Entry }
337- filter ( :category , :enum , :select => [ "first" , "second" ] , :checkboxes => true )
338- end
339- end
340- let ( :_filter ) { :category }
337+ let ( :_category_filter_options ) { { checkboxes : true } }
341338 it { should equal_to_dom (
342339 '
343340<label class="category enum_filter checkboxes" for="report_category_first"><input id="report_category_first" type="checkbox" value="first" name="report[category][]" />first</label>
0 commit comments