refactor(champ): remove type_de_champ_id and champ factories

This commit is contained in:
Paul Chavard 2024-07-01 15:31:32 +02:00
parent 860e06256f
commit 229483d16c
No known key found for this signature in database
120 changed files with 1144 additions and 1540 deletions

View file

@ -1,22 +1,24 @@
describe EditableChamp::ExplicationComponent, type: :component do
let(:procedure) { create(:procedure, :published, types_de_champ_public:) }
let(:dossier) { create(:dossier, :with_populated_champs, procedure:) }
let(:champ) { dossier.champs.first }
let(:component) {
described_class.new(form: instance_double(ActionView::Helpers::FormBuilder, object_name: "dossier[champs_public_attributes]"), champ:)
}
let(:champ) { create(:champ_explication) }
describe 'no description' do
let(:types_de_champ_public) { [{ type: :explication }] }
subject { render_inline(component).to_html }
it { is_expected.not_to have_button("Lire plus") }
end
describe 'collapsed text is collapsed' do
subject { render_inline(component).to_html }
let(:types_de_champ_public) { [{ type: :explication, collapsible_explanation_enabled: "1", collapsible_explanation_text: "hide me" }] }
before do
champ.type_de_champ.update!(collapsible_explanation_enabled: "1", collapsible_explanation_text: "hide me")
end
subject { render_inline(component).to_html }
it { is_expected.to have_button("Lire plus") }
it { is_expected.to have_selector(".fr-collapse", text: "hide me") }