Skip to content

Commit d39cd34

Browse files
committed
Remove outdated tests
1 parent 07e95a3 commit d39cd34

File tree

2 files changed

+4
-30
lines changed

2 files changed

+4
-30
lines changed

lib/datagrid/form_builder.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def datagrid_label(filter_or_attribute, text = nil, **options, &block)
4747
# * `type` - special attribute the determines an input tag to be made.
4848
# Examples: `text`, `select`, `textarea`, `number`, `date` etc.
4949
# @return [String] an input tag for the corresponding filter name
50-
def datagrid_filter_input(attribute_or_filter, **options, &block)
50+
def datagrid_filter_input(attribute_or_filter, select_choices: nil, select_options: nil, **options, &block)
5151
filter = datagrid_get_filter(attribute_or_filter)
5252
options = add_filter_options(filter, **options)
5353
type = options.delete(:type)&.to_sym
@@ -73,12 +73,12 @@ def datagrid_filter_input(attribute_or_filter, **options, &block)
7373
when :select
7474
select(
7575
filter.name,
76-
options.delete(:select_choices) || object.select_choices(filter) || [],
76+
select_choices || object.select_choices(filter) || [],
7777
{
7878
include_blank: filter.include_blank,
7979
prompt: filter.prompt,
8080
include_hidden: false,
81-
**options.delete(:select_options),
81+
**select_options,
8282
},
8383
multiple: filter.multiple?,
8484
**options,
@@ -157,6 +157,7 @@ def datagrid_dynamic_field_options(options:, field:, filter:)
157157
options.merge(
158158
{
159159
type: :select,
160+
select_choices: object.select_choices(filter),
160161
select_options: {
161162
selected: field,
162163
},

spec/datagrid/form_builder_spec.rb

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -783,33 +783,6 @@ class MyTemplate
783783

784784
it { is_expected.to equal_to_dom(expected_html) }
785785
end
786-
787-
context "when the field is predefined" do
788-
let(:filter_options) do
789-
{ operations: %w[>= <=], select: [:id] }
790-
end
791-
let(:expected_html) do
792-
<<-HTML
793-
<input class="datagrid-dynamic-field" name="report[condition][field]" value="id" autocomplete="off" type="hidden" id="report_condition"><select class="datagrid-dynamic-operation" name="report[condition][operation]" id="report_condition"><option value="&gt;="></option>
794-
<option value="&lt;="></option></select><input class="datagrid-dynamic-value" name="report[condition][value]" type="text" id="report_condition">
795-
HTML
796-
end
797-
798-
it { is_expected.to equal_to_dom(expected_html) }
799-
end
800-
801-
context "when operation is predefined" do
802-
let(:filter_options) do
803-
{ operations: %w[=], select: %i[id name] }
804-
end
805-
let(:expected_html) do
806-
<<-HTML
807-
<select class="datagrid-dynamic-field" name="report[condition][field]" id="report_condition"><option value="id">id</option><option value="name">name</option></select><input class="datagrid-dynamic-operation" name="report[condition][operation]" value="=" autocomplete="off" type="hidden" id="report_condition"><input class="datagrid-dynamic-value" name="report[condition][value]" type="text" id="report_condition">
808-
HTML
809-
end
810-
811-
it { is_expected.to equal_to_dom(expected_html) }
812-
end
813786
end
814787
end
815788

0 commit comments

Comments
 (0)