Convert radios in edit org type page (basic)

Changes the OrganisationTypeField class used by
OrganisationOrganisationTypeForm.organisation_type

OrganisationTypeField is also used by the forms in
/add-service:
- CreateServiceForm
- CreateNhsServiceForm

Because of that, this commit also includes changes
to the template for that route.

Note: this also moves where OrganisationTypeField
appears in app/main/forms.py so it can use
GovukRadiosField.
This commit is contained in:
Tom Byers
2020-06-26 20:39:20 +01:00
parent 5826dd9733
commit 0cdbb850aa
4 changed files with 28 additions and 30 deletions

View File

@@ -37,7 +37,7 @@ def test_get_should_render_add_service_template(
assert page.select_one('h1').text.strip() == 'About your service'
assert page.select_one('input[name=name]').get('value') is None
assert [
label.text.strip() for label in page.select('.multiple-choice label')
label.text.strip() for label in page.select('.govuk-radios__item label')
] == [
'Central government',
'Local government',
@@ -49,7 +49,7 @@ def test_get_should_render_add_service_template(
'Other',
]
assert [
radio['value'] for radio in page.select('.multiple-choice input')
radio['value'] for radio in page.select('.govuk-radios__item input')
] == [
'central',
'local',
@@ -193,8 +193,8 @@ def test_add_service_has_to_choose_org_type(
},
_expected_status=200,
)
assert normalize_spaces(page.select_one('.error-message').text) == (
'Select the type of organisation'
assert normalize_spaces(page.select_one('.govuk-error-message').text) == (
'Error: Select the type of organisation'
)
assert mock_create_service.called is False
assert mock_create_service_template.called is False
@@ -223,14 +223,14 @@ def test_get_should_only_show_nhs_org_types_radios_if_user_has_nhs_email(
assert page.select_one('h1').text.strip() == 'About your service'
assert page.select_one('input[name=name]').get('value') is None
assert [
label.text.strip() for label in page.select('.multiple-choice label')
label.text.strip() for label in page.select('.govuk-radios__item label')
] == [
'NHS central government agency or public body',
'NHS Trust or Clinical Commissioning Group',
'GP practice',
]
assert [
radio['value'] for radio in page.select('.multiple-choice input')
radio['value'] for radio in page.select('.govuk-radios__item input')
] == [
'nhs_central',
'nhs_local',