diff --git a/app/main/forms.py b/app/main/forms.py index f490e6d04..fbe29e759 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -1033,7 +1033,7 @@ class RenameServiceForm(StripWhitespaceForm): class RenameOrganisationForm(StripWhitespaceForm): - name = StringField( + name = GovukTextInputField( u'Organisation name', validators=[ DataRequired(message='Cannot be empty'), diff --git a/app/templates/views/organisations/add-organisation.html b/app/templates/views/organisations/add-organisation.html index e5d9675f2..bafda2f9e 100644 --- a/app/templates/views/organisations/add-organisation.html +++ b/app/templates/views/organisations/add-organisation.html @@ -26,9 +26,9 @@ {% block content %} {{ page_header('New organisation') }} {% call form_wrapper() %} - {{textbox(form.name)}} - {{radios(form.organisation_type)}} - {{radios(form.crown_status)}} + {{ form.name }} + {{ radios(form.organisation_type) }} + {{ radios(form.crown_status) }} {{ page_footer('Save') }} {% endcall %} {% endblock %} diff --git a/app/templates/views/organisations/organisation/settings/edit-name/index.html b/app/templates/views/organisations/organisation/settings/edit-name/index.html index 5e9f5b7c4..a3a6bfbc8 100644 --- a/app/templates/views/organisations/organisation/settings/edit-name/index.html +++ b/app/templates/views/organisations/organisation/settings/edit-name/index.html @@ -16,7 +16,7 @@ ) }} {% call form_wrapper() %} - {{textbox(form.name)}} + {{ form.name }} {{ page_footer('Save') }} {% endcall %} diff --git a/tests/app/main/views/organisations/test_organisation.py b/tests/app/main/views/organisations/test_organisation.py index 4aff7ba3a..99f4efe40 100644 --- a/tests/app/main/views/organisations/test_organisation.py +++ b/tests/app/main/views/organisations/test_organisation.py @@ -88,10 +88,10 @@ def test_page_to_create_new_organisation( page = client_request.get('.add_organisation') assert [ - (input['type'], input['name'], input['value']) + (input['type'], input['name'], input.get('value')) for input in page.select('input') ] == [ - ('text', 'name', ''), + ('text', 'name', None), ('radio', 'organisation_type', 'central'), ('radio', 'organisation_type', 'local'), ('radio', 'organisation_type', 'nhs_central'), @@ -155,9 +155,9 @@ def test_create_new_organisation_validates( ) assert [ (error['data-error-label'], normalize_spaces(error.text)) - for error in page.select('.error-message') + for error in page.select('.govuk-error-message, .error-message') ] == [ - ('name', 'Cannot be empty'), + ('name', 'Error: Cannot be empty'), ('organisation_type', 'Select the type of organisation'), ('crown_status', 'Select whether this organisation is a crown body'), ] @@ -184,7 +184,7 @@ def test_create_new_organisation_fails_if_new_name_has_less_than_2_alphanumeric_ _expected_status=200, ) assert mock_create_organisation.called is False - assert page.find("span", {"class": "error-message"}) + assert page.find("span", {"class": "govuk-error-message"}) @pytest.mark.parametrize('organisation_type, organisation, expected_status', ( @@ -1056,9 +1056,7 @@ def test_update_organisation_with_incorrect_input( assert response.status_code == 200 page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') - assert normalize_spaces( - page.select_one('.error-message').text - ) == "Cannot be empty" + assert "Cannot be empty" in page.select_one('.govuk-error-message').text def test_update_organisation_with_non_unique_name( @@ -1075,9 +1073,7 @@ def test_update_organisation_with_non_unique_name( assert response.status_code == 200 page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') - assert normalize_spaces( - page.select_one('.error-message').text - ) == 'This organisation name is already in use' + assert 'This organisation name is already in use' in page.select_one('.govuk-error-message').text assert mock_organisation_name_is_not_unique.called