From a05b1264cad270bbc758d378dd493f8a0bbc83df Mon Sep 17 00:00:00 2001 From: Matthew Phelan Date: Wed, 8 Dec 2021 16:55:21 +0000 Subject: [PATCH 1/2] Text Area Added --- app/views/form/_textarea_question.html.erb | 7 +++++++ config/forms/2021_2022.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 app/views/form/_textarea_question.html.erb diff --git a/app/views/form/_textarea_question.html.erb b/app/views/form/_textarea_question.html.erb new file mode 100644 index 000000000..b9644496e --- /dev/null +++ b/app/views/form/_textarea_question.html.erb @@ -0,0 +1,7 @@ +<%= f.govuk_text_area question.id.to_sym, + caption: caption && !page_header.present? ? { text: caption.html_safe, size: "l" } : nil, + label: { text: question.header.html_safe, size: !page_header.present? ? "l" : "m", tag: !page_header.present? ? "h1" : "h2" }, + hint: { text: question.hint_text }, + width: question.width ? question.width : nil, + **stimulus_html_attributes(question) +%> diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 5d24ddc84..a9b458c2e 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -1483,7 +1483,7 @@ "check_answer_label": "Reason for not knowing local authority", "header": "Give a reason why you don’t know the postcode or local authority", "hint_text": "", - "type": "text" + "type": "textarea" } }, "depends_on": { "la_known": "No" } From a0c3a9378c794bb9ac934a255def0f2a75a8618f Mon Sep 17 00:00:00 2001 From: Matthew Phelan Date: Thu, 9 Dec 2021 14:00:47 +0000 Subject: [PATCH 2/2] textarea test added --- spec/fixtures/forms/test_form.json | 12 ++++++++++++ spec/models/form_handler_spec.rb | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/spec/fixtures/forms/test_form.json b/spec/fixtures/forms/test_form.json index 95add8988..71d002e13 100644 --- a/spec/fixtures/forms/test_form.json +++ b/spec/fixtures/forms/test_form.json @@ -532,6 +532,18 @@ } } }, + "why_dont_you_know_la": { + "header": "", + "description": "", + "questions": { + "why_dont_you_know_la": { + "check_answer_label": "Reason for not knowing local authority", + "header": "Give a reason why you don’t know the postcode or local authority", + "hint_text": "", + "type": "textarea" + } + } + }, "property_postcode": { "questions": { "property_postcode": { diff --git a/spec/models/form_handler_spec.rb b/spec/models/form_handler_spec.rb index 89cb98542..e87765aac 100644 --- a/spec/models/form_handler_spec.rb +++ b/spec/models/form_handler_spec.rb @@ -15,7 +15,7 @@ RSpec.describe FormHandler do form_handler = FormHandler.instance form = form_handler.get_form("test_form") expect(form).to be_a(Form) - expect(form.pages.count).to eq(24) + expect(form.pages.count).to eq(25) end end