remove drop_down_list_value reader
This commit is contained in:
parent
483076970c
commit
5a19cc1a09
3 changed files with 8 additions and 12 deletions
|
@ -72,7 +72,11 @@
|
|||
.flex.column.justify-start.width-33
|
||||
.cell
|
||||
= form.label :drop_down_list_value, "Options de la liste", for: dom_id(type_de_champ, :drop_down_list_value)
|
||||
= form.text_area :drop_down_list_value, class: 'fr-input small-margin small width-100', rows: 7, id: dom_id(type_de_champ, :drop_down_list_value)
|
||||
= form.text_area :drop_down_list_value,
|
||||
value: type_de_champ.drop_down_options.join("\r\n"),
|
||||
class: 'fr-input small-margin small width-100',
|
||||
rows: 7,
|
||||
id: dom_id(type_de_champ, :drop_down_list_value)
|
||||
- if type_de_champ.simple_drop_down_list?
|
||||
.cell
|
||||
= form.label :drop_down_other, for: dom_id(type_de_champ, :drop_down_other) do
|
||||
|
|
|
@ -490,14 +490,6 @@ class TypeDeChamp < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def drop_down_list_value
|
||||
if drop_down_options.present?
|
||||
drop_down_options.reject(&:empty?).join("\r\n")
|
||||
else
|
||||
''
|
||||
end
|
||||
end
|
||||
|
||||
def drop_down_list_value=(value)
|
||||
self.drop_down_options = value.to_s.lines.map(&:strip).reject(&:empty?)
|
||||
end
|
||||
|
|
|
@ -27,8 +27,8 @@ describe '20240912091625_clean_drop_down_options.rake' do
|
|||
after { rake_task.reenable }
|
||||
|
||||
it 'removes the hidden options' do
|
||||
expect(dashed_drop_down_list.drop_down_list_value).to eq(['1', '2'].join("\r\n"))
|
||||
expect(witness_drop_down_list.drop_down_list_value).to eq(['1', 'hi', '2'].join("\r\n"))
|
||||
expect(multiple_drop_down_list.drop_down_list_value).to eq(['1', '2'].join("\r\n"))
|
||||
expect(dashed_drop_down_list.drop_down_options).to eq(['1', '2'])
|
||||
expect(witness_drop_down_list.drop_down_options).to eq(['1', 'hi', '2'])
|
||||
expect(multiple_drop_down_list.drop_down_options).to eq(['1', '2'])
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue