refactor(champ): remove type_de_champ_id and champ factories
This commit is contained in:
parent
860e06256f
commit
229483d16c
120 changed files with 1144 additions and 1540 deletions
|
@ -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") }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue