Browse Source

Merge pull request #156 from communitiesuk/CLDC-776/TextAreaQuestionType

Text Area Added
pull/160/head
Matthew J. Phelan 3 years ago committed by GitHub
parent
commit
643d10ef8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      app/views/form/_textarea_question.html.erb
  2. 2
      config/forms/2021_2022.json
  3. 12
      spec/fixtures/forms/test_form.json
  4. 2
      spec/models/form_handler_spec.rb

7
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)
%>

2
config/forms/2021_2022.json

@ -1483,7 +1483,7 @@
"check_answer_label": "Reason for not knowing local authority", "check_answer_label": "Reason for not knowing local authority",
"header": "Give a reason why you don’t know the postcode or local authority", "header": "Give a reason why you don’t know the postcode or local authority",
"hint_text": "", "hint_text": "",
"type": "text" "type": "textarea"
} }
}, },
"depends_on": { "la_known": "No" } "depends_on": { "la_known": "No" }

12
spec/fixtures/forms/test_form.json vendored

@ -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": { "property_postcode": {
"questions": { "questions": {
"property_postcode": { "property_postcode": {

2
spec/models/form_handler_spec.rb

@ -15,7 +15,7 @@ RSpec.describe FormHandler do
form_handler = FormHandler.instance form_handler = FormHandler.instance
form = form_handler.get_form("test_form") form = form_handler.get_form("test_form")
expect(form).to be_a(Form) expect(form).to be_a(Form)
expect(form.pages.count).to eq(24) expect(form.pages.count).to eq(25)
end end
end end

Loading…
Cancel
Save