Skip to content

Commit

Permalink
Fix build for rails 6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan committed Jan 9, 2023
1 parent 23b11a1 commit 98ae870
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions spec/datagrid/form_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class MyTemplate
let(:view_options) { {} }

SELECT_EMPTY_OPTION = Rails.version >= "6.0" ? '<option value="" label=" "></option>' : '<option value=""></option>'
AUTOCOMPLETE_OPTION = Rails.version >= "7.0" ? 'autocomplete="off"' : ''


describe ".datagrid_filter" do
Expand Down Expand Up @@ -365,7 +366,7 @@ class MyTemplate
end
it { should equal_to_dom(
# hidden is important when default is set to true
'<input name="report[disabled]" type="hidden" value="0" autocomplete="off"><input class="disabled boolean_filter" type="checkbox" value="1" checked name="report[disabled]" id="report_disabled">'
%{<input name="report[disabled]" type="hidden" value="0" #{AUTOCOMPLETE_OPTION}><input class="disabled boolean_filter" type="checkbox" value="1" checked name="report[disabled]" id="report_disabled">}
)}
end
context "with xboolean filter type" do
Expand Down Expand Up @@ -576,7 +577,7 @@ class MyTemplate
end
let(:expected_html) do
<<-HTML
<input class="condition dynamic_filter field" name="report[condition][]" value="id" autocomplete="off" type="hidden" id="report_condition"><select class="condition dynamic_filter operation" name="report[condition][]" id="report_condition"><option value="&gt;="></option>
<input class="condition dynamic_filter field" name="report[condition][]" value="id" #{AUTOCOMPLETE_OPTION} type="hidden" id="report_condition"><select class="condition dynamic_filter operation" name="report[condition][]" id="report_condition"><option value="&gt;="></option>
<option value="&lt;="></option></select><input class="condition dynamic_filter value" name="report[condition][]" type="text" id="report_condition">
HTML
end
Expand All @@ -588,7 +589,7 @@ class MyTemplate
end
let(:expected_html) do
<<-HTML
<select class="condition dynamic_filter field" name="report[condition][]" id="report_condition"><option value="id">id</option><option value="name">name</option></select><input class="condition dynamic_filter operation" name="report[condition][]" value="=" autocomplete="off" type="hidden" id="report_condition"><input class="condition dynamic_filter value" name="report[condition][]" type="text" id="report_condition">
<select class="condition dynamic_filter field" name="report[condition][]" id="report_condition"><option value="id">id</option><option value="name">name</option></select><input class="condition dynamic_filter operation" name="report[condition][]" value="=" #{AUTOCOMPLETE_OPTION} type="hidden" id="report_condition"><input class="condition dynamic_filter value" name="report[condition][]" type="text" id="report_condition">
HTML
end
it {should equal_to_dom(expected_html)}
Expand Down

0 comments on commit 98ae870

Please sign in to comment.