[ {"name": "three boxes under a legend, named after the id", "args": [{"id": "passport-issued", "legend": "When was your passport issued?"}], "expect": "
"}, {"name": "a hint describes the group, GOV.UK's example", "args": [{"id": "passport-issued", "legend": "When was your passport issued?", "hint": "For example, 27 3 2007", "isPageHeading": true}], "expect": ""}, {"name": "a date of birth autocompletes each box", "args": [{"id": "dob", "legend": "What is your date of birth?", "birthday": true}], "expect": ""}, {"name": "birthday false adds no autocomplete", "args": [{"id": "dob", "legend": "What is your date of birth?", "birthday": false}], "expect": ""}, {"name": "an error with no fields named marks the whole date", "args": [{"id": "dob", "legend": "Date of birth", "error": "Enter date of birth"}], "expect": ""}, {"name": "an error with an empty list of fields marks the whole date too", "args": [{"id": "dob", "legend": "Date of birth", "error": "Enter date of birth", "errorFields": []}], "expect": ""}, {"name": "errorFields from validateDateParts marks only the year", "args": [{"id": "passport-issued", "legend": "When was your passport issued?", "hint": "For example, 27 3 2007", "error": "The date your passport was issued must include a year", "errorFields": ["year"], "value": {"day": "6", "month": "3", "year": ""}}], "expect": ""}, {"name": "two fields in error", "args": [{"id": "dob", "legend": "Date of birth", "error": "Date of birth must include a day and year", "errorFields": ["day", "year"]}], "expect": ""}, {"name": "errorFields without an error marks nothing", "args": [{"id": "dob", "legend": "Date of birth", "errorFields": ["day"]}], "expect": ""}, {"name": "a name of its own prefixes the boxes' names, ids stay", "args": [{"id": "f7", "name": "dob", "legend": "Date of birth"}], "expect": ""}, {"name": "a default value fills the boxes", "args": [{"id": "dob", "legend": "Date of birth", "defaultValue": {"day": "27", "month": "jan", "year": "2007"}}], "expect": ""}, {"name": "disabled, with a class name and autocomplete", "args": [{"id": "dob", "legend": "Date of birth", "disabled": true, "birthday": true, "className": "fune-field--compact"}], "expect": ""}, {"name": "values are escaped", "args": [{"id": "d", "legend": "Start & end", "value": {"day": "<1>", "month": "\"2\"", "year": "a&b"}}], "expect": ""}, {"name": "an id with a space is refused", "args": [{"id": "date of birth", "legend": "Date of birth"}], "expectError": "a field id cannot contain spaces"} ]