mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 16:24:08 -04:00
Merge pull request #3727 from alphagov/add-govuk-radios-2
Add GOVUK radios [part 2]
This commit is contained in:
@@ -261,14 +261,14 @@ def test_nhs_local_can_create_own_organisations(
|
||||
'Which NHS Trust or Clinical Commissioning Group do you work for?'
|
||||
)
|
||||
assert page.select_one('[data-module=live-search]')['data-targets'] == (
|
||||
'.multiple-choice'
|
||||
'.govuk-radios__item'
|
||||
)
|
||||
assert [
|
||||
(
|
||||
normalize_spaces(radio.select_one('label').text),
|
||||
radio.select_one('input')['value']
|
||||
)
|
||||
for radio in page.select('.multiple-choice')
|
||||
for radio in page.select('.govuk-radios__item')
|
||||
] == [
|
||||
('Trust 1', 't1'),
|
||||
('Trust 2', 't2'),
|
||||
@@ -704,41 +704,44 @@ def test_organisation_settings_for_platform_admin(
|
||||
(
|
||||
'.edit_organisation_type',
|
||||
(
|
||||
('central', 'Central government'),
|
||||
('local', 'Local government'),
|
||||
('nhs_central', 'NHS – central government agency or public body'),
|
||||
('nhs_local', 'NHS Trust or Clinical Commissioning Group'),
|
||||
('nhs_gp', 'GP practice'),
|
||||
('emergency_service', 'Emergency service'),
|
||||
('school_or_college', 'School or college'),
|
||||
('other', 'Other'),
|
||||
{'value': 'central', 'label': 'Central government'},
|
||||
{'value': 'local', 'label': 'Local government'},
|
||||
{'value': 'nhs_central', 'label': 'NHS – central government agency or public body'},
|
||||
{'value': 'nhs_local', 'label': 'NHS Trust or Clinical Commissioning Group'},
|
||||
{'value': 'nhs_gp', 'label': 'GP practice'},
|
||||
{'value': 'emergency_service', 'label': 'Emergency service'},
|
||||
{'value': 'school_or_college', 'label': 'School or college'},
|
||||
{'value': 'other', 'label': 'Other'},
|
||||
),
|
||||
'central',
|
||||
),
|
||||
(
|
||||
'.edit_organisation_crown_status',
|
||||
(
|
||||
('crown', 'Yes'),
|
||||
('non-crown', 'No'),
|
||||
('unknown', 'Not sure'),
|
||||
{'value': 'crown', 'label': 'Yes'},
|
||||
{'value': 'non-crown', 'label': 'No'},
|
||||
{'value': 'unknown', 'label': 'Not sure'},
|
||||
),
|
||||
'crown',
|
||||
),
|
||||
(
|
||||
'.edit_organisation_agreement',
|
||||
(
|
||||
('yes', (
|
||||
'Yes '
|
||||
'Users will be told their organisation has already signed the agreement'
|
||||
)),
|
||||
('no', (
|
||||
'No '
|
||||
'Users will be prompted to sign the agreement before they can go live'
|
||||
)),
|
||||
('unknown', (
|
||||
'No (but we have some service-specific agreements in place) '
|
||||
'Users will not be prompted to sign the agreement'
|
||||
)),
|
||||
{
|
||||
'value': 'yes',
|
||||
'label': 'Yes',
|
||||
'hint': 'Users will be told their organisation has already signed the agreement'
|
||||
},
|
||||
{
|
||||
'value': 'no',
|
||||
'label': 'No',
|
||||
'hint': 'Users will be prompted to sign the agreement before they can go live'
|
||||
},
|
||||
{
|
||||
'value': 'unknown',
|
||||
'label': 'No (but we have some service-specific agreements in place)',
|
||||
'hint': 'Users will not be prompted to sign the agreement'
|
||||
},
|
||||
),
|
||||
'no',
|
||||
),
|
||||
@@ -769,11 +772,14 @@ def test_view_organisation_settings(
|
||||
radios = page.select('input[type=radio]')
|
||||
|
||||
for index, option in enumerate(expected_options):
|
||||
label = page.select_one('label[for={}]'.format(radios[index]['id']))
|
||||
assert (
|
||||
radios[index]['value'],
|
||||
normalize_spaces(label.text),
|
||||
) == option
|
||||
option_values = {
|
||||
'value': radios[index]['value'],
|
||||
'label': normalize_spaces(page.select_one('label[for={}]'.format(radios[index]['id'])).text)
|
||||
}
|
||||
if 'hint' in option:
|
||||
option_values['hint'] = normalize_spaces(
|
||||
page.select_one('label[for={}] + .govuk-hint'.format(radios[index]['id'])).text)
|
||||
assert option_values == option
|
||||
|
||||
if expected_selected:
|
||||
assert page.select_one('input[checked]')['value'] == expected_selected
|
||||
|
||||
@@ -744,7 +744,7 @@ def test_clear_cache_requires_option(client_request, platform_admin_user, mocker
|
||||
|
||||
page = client_request.post('main.clear_cache', _data={}, _expected_status=200)
|
||||
|
||||
assert normalize_spaces(page.find('span', class_='error-message').text) == 'Select an option'
|
||||
assert normalize_spaces(page.find('span', class_='govuk-error-message').text) == 'Error: Select an option'
|
||||
assert not redis.delete_cache_keys_by_pattern.called
|
||||
|
||||
|
||||
|
||||
@@ -4494,10 +4494,10 @@ def test_select_organisation(
|
||||
assert response.status_code == 200
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
|
||||
assert len(page.select('.multiple-choice')) == 3
|
||||
assert len(page.select('.govuk-radios__item')) == 3
|
||||
for i in range(0, 3):
|
||||
assert normalize_spaces(
|
||||
page.select('.multiple-choice label')[i].text
|
||||
page.select('.govuk-radios__item label')[i].text
|
||||
) == 'Org {}'.format(i + 1)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user