[
{"fn": "errorSummaryItems", "name": "one field, linked by its own name", "args": [{"email": "Enter an email address"}, ["email"], {}], "expect": [{"field": "email", "text": "Enter an email address", "href": "#email"}]},
{"fn": "errorSummaryItems", "name": "form order wins over the map's order", "args": [{"password": "Enter a password", "email": "Enter an email address"}, ["name", "email", "password"], {}], "expect": [{"field": "email", "text": "Enter an email address", "href": "#email"}, {"field": "password", "text": "Enter a password", "href": "#password"}]},
{"fn": "errorSummaryItems", "name": "fields the order leaves out follow, in the map's order", "args": [{"terms": "Accept the terms", "email": "Enter an email address", "extra": "Something else is wrong"}, ["email"], {}], "expect": [{"field": "email", "text": "Enter an email address", "href": "#email"}, {"field": "terms", "text": "Accept the terms", "href": "#terms"}, {"field": "extra", "text": "Something else is wrong", "href": "#extra"}]},
{"fn": "errorSummaryItems", "name": "a date links to its first box in error", "args": [{"dob": "Date of birth must include a month", "name": "Enter your full name"}, ["name", "dob"], {"dob": "dob-month"}], "expect": [{"field": "name", "text": "Enter your full name", "href": "#name"}, {"field": "dob", "text": "Date of birth must include a month", "href": "#dob-month"}]},
{"fn": "errorSummaryItems", "name": "a target for a field without an error is ignored", "args": [{"name": "Enter your full name"}, ["name", "dob"], {"dob": "dob-day"}], "expect": [{"field": "name", "text": "Enter your full name", "href": "#name"}]},
{"fn": "errorSummaryItems", "name": "no errors, no items", "args": [{}, ["name", "email"], {}], "expect": []},
{"fn": "errorSummaryItems", "name": "an empty message is no error", "args": [{"name": "", "email": "Enter an email address"}, ["name", "email"], {}], "expect": [{"field": "email", "text": "Enter an email address", "href": "#email"}]},
{"fn": "errorSummaryItems", "name": "a name repeated in the order is listed once", "args": [{"email": "Enter an email address"}, ["email", "email"], {}], "expect": [{"field": "email", "text": "Enter an email address", "href": "#email"}]},
{"fn": "errorSummaryItems", "name": "an empty order keeps the map's order", "args": [{"b": "B is wrong", "a": "A is wrong"}, [], {}], "expect": [{"field": "b", "text": "B is wrong", "href": "#b"}, {"field": "a", "text": "A is wrong", "href": "#a"}]},
{"fn": "errorSummaryItems", "name": "a GOV.UK-style id with dashes, from GOV.UK's example", "args": [{"fullName": "Enter your full name"}, [], {"fullName": "full-name-input"}], "expect": [{"field": "fullName", "text": "Enter your full name", "href": "#full-name-input"}]},
{"fn": "errorSummaryItems", "name": "a target with a space is refused", "args": [{"name": "Enter your full name"}, [], {"name": "full name"}], "expectError": "a field id cannot contain spaces (\"full name\")"},
{"fn": "errorSummaryItems", "name": "a field name with a space and no target is refused", "args": [{"first name": "Enter your first name"}, [], {}], "expectError": "a field id cannot contain spaces"},
{"fn": "errorSummaryItems", "name": "an empty target is refused", "args": [{"name": "Enter your full name"}, [], {"name": ""}], "expectError": "the error summary link for \"name\" needs an id"},
{"fn": "ErrorSummary", "name": "GOV.UK's example: two errors under There is a problem", "args": [{"id": "errors", "items": [{"field": "name", "text": "Enter your full name", "href": "#full-name"}, {"field": "issued", "text": "The date your passport was issued must be in the past", "href": "#passport-issued-day"}]}], "expect": "<div class=\"fune-error-summary\" id=\"errors\" tabindex=\"-1\"><div role=\"alert\"><h2 class=\"fune-error-summary-title\">There is a problem</h2><div class=\"fune-error-summary-body\"><ul class=\"fune-error-summary-list\"><li><a href=\"#full-name\">Enter your full name</a></li><li><a href=\"#passport-issued-day\">The date your passport was issued must be in the past</a></li></ul></div></div></div>"},
{"fn": "ErrorSummary", "name": "one error still gets a summary", "args": [{"id": "errors", "items": [{"field": "email", "text": "Enter an email address", "href": "#email"}]}], "expect": "<div class=\"fune-error-summary\" id=\"errors\" tabindex=\"-1\"><div role=\"alert\"><h2 class=\"fune-error-summary-title\">There is a problem</h2><div class=\"fune-error-summary-body\"><ul class=\"fune-error-summary-list\"><li><a href=\"#email\">Enter an email address</a></li></ul></div></div></div>"},
{"fn": "ErrorSummary", "name": "no items render nothing", "args": [{"id": "errors", "items": []}], "expect": ""},
{"fn": "ErrorSummary", "name": "a title of its own", "args": [{"id": "errors", "title": "Check your answers", "items": [{"field": "email", "text": "Enter an email address", "href": "#email"}]}], "expect": "<div class=\"fune-error-summary\" id=\"errors\" tabindex=\"-1\"><div role=\"alert\"><h2 class=\"fune-error-summary-title\">Check your answers</h2><div class=\"fune-error-summary-body\"><ul class=\"fune-error-summary-list\"><li><a href=\"#email\">Enter an email address</a></li></ul></div></div></div>"},
{"fn": "ErrorSummary", "name": "an empty title falls back to There is a problem", "args": [{"id": "errors", "title": "", "items": [{"field": "email", "text": "Enter an email address", "href": "#email"}]}], "expect": "<div class=\"fune-error-summary\" id=\"errors\" tabindex=\"-1\"><div role=\"alert\"><h2 class=\"fune-error-summary-title\">There is a problem</h2><div class=\"fune-error-summary-body\"><ul class=\"fune-error-summary-list\"><li><a href=\"#email\">Enter an email address</a></li></ul></div></div></div>"},
{"fn": "ErrorSummary", "name": "a description goes above the list", "args": [{"id": "errors", "description": "Fix the following to continue", "items": [{"field": "email", "text": "Enter an email address", "href": "#email"}]}], "expect": "<div class=\"fune-error-summary\" id=\"errors\" tabindex=\"-1\"><div role=\"alert\"><h2 class=\"fune-error-summary-title\">There is a problem</h2><div class=\"fune-error-summary-body\"><p>Fix the following to continue</p><ul class=\"fune-error-summary-list\"><li><a href=\"#email\">Enter an email address</a></li></ul></div></div></div>"},
{"fn": "ErrorSummary", "name": "a class name joins the summary's", "args": [{"id": "top-errors", "className": "page-errors", "disableAutoFocus": true, "items": [{"field": "email", "text": "Enter an email address", "href": "#email"}]}], "expect": "<div class=\"fune-error-summary page-errors\" id=\"top-errors\" tabindex=\"-1\"><div role=\"alert\"><h2 class=\"fune-error-summary-title\">There is a problem</h2><div class=\"fune-error-summary-body\"><ul class=\"fune-error-summary-list\"><li><a href=\"#email\">Enter an email address</a></li></ul></div></div></div>"},
{"fn": "ErrorSummary", "name": "messages are escaped", "args": [{"id": "e", "items": [{"field": "q", "text": "Search must not include <script> & \"quotes\"", "href": "#q"}]}], "expect": "<div class=\"fune-error-summary\" id=\"e\" tabindex=\"-1\"><div role=\"alert\"><h2 class=\"fune-error-summary-title\">There is a problem</h2><div class=\"fune-error-summary-body\"><ul class=\"fune-error-summary-list\"><li><a href=\"#q\">Search must not include <script> & "quotes"</a></li></ul></div></div></div>"}
]