|
1 | 1 | require "rails_helper" |
2 | 2 |
|
3 | 3 | describe "forms/check_your_answers/show.html.erb" do |
4 | | - let(:form) { build :form, :with_support, id: 1, declaration_text: } |
| 4 | + let(:form) { build :form, :with_support, id: 1, declaration_text:, declaration_markdown: } |
5 | 5 | let(:support_details) { OpenStruct.new(email: form.support_email) } |
6 | 6 | let(:context) { OpenStruct.new(form:) } |
7 | 7 | let(:full_width) { false } |
8 | 8 | let(:declaration_text) { nil } |
| 9 | + let(:declaration_markdown) { nil } |
9 | 10 | let(:email_confirmation_input) { build :email_confirmation_input } |
10 | 11 | let(:question) { build :text, question_text: "Do you want to remain anonymous?", text: "Yes" } |
11 | 12 | let(:steps) { [build(:step, question:, page: build(:page, :with_text_settings))] } |
|
41 | 42 | end |
42 | 43 | end |
43 | 44 |
|
| 45 | + context "when the form has a markdown declaration and declaration text" do |
| 46 | + let(:declaration_text) { "You should agree to all terms before submitting" } |
| 47 | + let(:declaration_markdown) { "This is the markdown decalaration\n\nsecond paragraph" } |
| 48 | + |
| 49 | + it "displays the declaration heading" do |
| 50 | + expect(rendered).to have_css("h2", text: "Declaration") |
| 51 | + end |
| 52 | + |
| 53 | + it "displays declaration markdown" do |
| 54 | + expect(rendered).to have_css("p", text: "second paragraph") |
| 55 | + end |
| 56 | + |
| 57 | + it "does not display declaration text" do |
| 58 | + expect(rendered).not_to have_css("p", text: form.declaration_text) |
| 59 | + end |
| 60 | + end |
| 61 | + |
| 62 | + context "when the form has a markdown declaration only" do |
| 63 | + let(:declaration_markdown) { "This is the markdown decalaration\n\nsecond paragraph" } |
| 64 | + |
| 65 | + it "displays the declaration heading" do |
| 66 | + expect(rendered).to have_css("h2", text: "Declaration") |
| 67 | + end |
| 68 | + |
| 69 | + it "displays declaration markdown" do |
| 70 | + expect(rendered).to have_css("p", text: "second paragraph") |
| 71 | + end |
| 72 | + end |
| 73 | + |
44 | 74 | it "displays the summary list two-thirds width" do |
45 | 75 | expect(rendered).not_to have_css(".govuk-grid-column-full .govuk-summary-list") |
46 | 76 | expect(rendered).to have_css(".govuk-grid-column-two-thirds-from-desktop .govuk-summary-list") |
|
0 commit comments