x-govuk/govuk-form-builder

Make label, legend, hint and caption raise if they're passed a block instead of a proc

Closed this issue · 1 comments

As mentioned in #177, when the label argument is passed a block instead of a proc it overwrites the entire element.

Taking a block isn't (and can't easily be) supported but the current behaviour is plain unhelpful. It's an easy mistake to make, there should be a helpful error message here instead.

  • add a check that raises an appropriate error if a block is passed into label, hint, caption or legend
  • test it in all circumstances, including with supplementary content
  • add a note in the guide showing common solutions (render, calling helpers, etc)

This was fixed by #183, templating blocks now work as expected.