Merge pull request #11062 from tchak/column-better-cast
ETQ dev, je souhaite obtenir la valeur humaine d'une colonne
This commit is contained in:
commit
ee9a493877
7 changed files with 57 additions and 39 deletions
|
@ -35,7 +35,7 @@ describe Instructeurs::FilterButtonsComponent, type: :component do
|
|||
let(:filter) { to_filter(['État du dossier', "en_construction"]) }
|
||||
|
||||
it 'should get i18n value' do
|
||||
expect(page).to have_text("En construction")
|
||||
expect(page).to have_text("En construction")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -57,7 +57,7 @@ describe Instructeurs::FilterButtonsComponent, type: :component do
|
|||
end
|
||||
|
||||
it 'should display all filters' do
|
||||
text = "État du dossier : En construction ou État du dossier : En instruction et Date de création : 15/06/2023"
|
||||
text = "État du dossier : En construction ou État du dossier : En instruction et Date de création : 15/06/2023"
|
||||
expect(page).to have_text(text)
|
||||
end
|
||||
end
|
||||
|
@ -78,7 +78,7 @@ describe Instructeurs::FilterButtonsComponent, type: :component do
|
|||
expect(page.all('form').count).to eq(2)
|
||||
|
||||
del_en_construction = page.all('form').first
|
||||
expect(del_en_construction).to have_text('En construction')
|
||||
expect(del_en_construction).to have_text('En construction')
|
||||
expect(del_en_construction).to have_field('filters[]', with: '', type: 'hidden')
|
||||
expect(del_en_construction).to have_field('filters[][id]', with: column_id, type: 'hidden')
|
||||
expect(del_en_construction).to have_field('filters[][filter]', with: 'en_instruction', type: 'hidden')
|
||||
|
|
|
@ -100,21 +100,39 @@ describe Columns::ChampColumn do
|
|||
end
|
||||
|
||||
context 'from a drop_down_list' do
|
||||
let(:champ) { Champs::DropDownListChamp.new(value: 'val1') }
|
||||
let(:champ) { Champs::DropDownListChamp.new(value:) }
|
||||
let(:value) { 'val1' }
|
||||
|
||||
it do
|
||||
expect(column('multiple_drop_down_list').value(champ)).to eq(['val1'])
|
||||
expect(column('text').value(champ)).to eq('val1')
|
||||
end
|
||||
|
||||
context 'value not in options' do
|
||||
let(:value) { 'toto' }
|
||||
|
||||
it do
|
||||
expect(column('simple_drop_down_list').value(champ)).to eq(nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'from a multiple_drop_down_list' do
|
||||
let(:champ) { Champs::MultipleDropDownListChamp.new(value: '["val1","val2"]') }
|
||||
let(:champ) { Champs::MultipleDropDownListChamp.new(value:) }
|
||||
let(:value) { '["val1","val2"]' }
|
||||
|
||||
it do
|
||||
expect(column('simple_drop_down_list').value(champ)).to eq('val1')
|
||||
expect(column('text').value(champ)).to eq('val1, val2')
|
||||
end
|
||||
|
||||
context 'value not in options' do
|
||||
let(:value) { '["toto","val2"]' }
|
||||
|
||||
it do
|
||||
expect(column('multiple_drop_down_list').value(champ)).to eq(['val2'])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue