* Set grey background if the field is readonly * fix tests
@ -10,6 +10,7 @@ module QuestionAttributeHelper
private
def numeric_question_html_attributes(question)
return { "style": "background-color: #f3f2f1;" } if question.read_only?
return {} if question.fields_to_add.blank? || question.result_field.blank?
{
@ -541,6 +541,23 @@
"requires_js": true
}
},
"weekly_net_income": {
"header": "",
"description": "",
"questions": {
"earnings": {
"check_answer_label": "Total household income",
"header": "How much income does the household have in total every week?",
"hint_text": "",
"type": "numeric",
"min": 0,
"step": "1",
"width": 5,
"prefix": "£",
"suffix": " every week"
@ -7,7 +7,7 @@ RSpec.describe QuestionAttributeHelper do
describe "html attributes" do
it "returns empty hash if fields-to-add or result-field are empty " do
question = questions.find { |q| q.id == "tcharge" }
question = form.get_page("weekly_net_income").questions.find { |q| q.id == "earnings" }
expect(stimulus_html_attributes(question)).to eq({})
end
@ -16,7 +16,7 @@ RSpec.describe FormHandler do
form_handler = FormHandler.instance
form = form_handler.get_form(test_form_name)
expect(form).to be_a(Form)
expect(form.pages.count).to eq(28)
expect(form.pages.count).to eq(29)