demarches-normaliennes/spec/models/champs/repetition_champ_spec.rb

36 lines
756 B
Ruby
Raw Normal View History

# frozen_string_literal: true
describe Champs::RepetitionChamp do
let(:procedure) {
create(:procedure,
types_de_champ_public: [
{
type: :repetition,
children: [{ type: :text, libelle: "Ext" }], libelle: "Languages"
}
])
}
let(:dossier) { create(:dossier, procedure:) }
2024-09-27 15:44:57 +02:00
let(:champ) { dossier.champs.find(&:repetition?) }
describe "#for_tag" do
before do
champ.rows[0][0].update(value: "rb")
end
it "can render as string" do
expect(champ.for_tag.to_s).to eq(
<<~TXT.strip
Languages
Ext : rb
TXT
)
end
it "as tiptap node" do
expect(champ.for_tag.to_tiptap_node).to include(type: 'orderedList')
end
end
end