mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
Merge pull request #3594 from alphagov/fix-live-search-sub-areas
Don’t filter ‘All of’ choice with live search
This commit is contained in:
@@ -22,9 +22,11 @@
|
||||
{{ form.select_all }}
|
||||
</div>
|
||||
|
||||
{{ live_search(target_selector='.govuk-checkboxes__item', show=show_search_form, form=search_form, label='Or by electoral ward') }}
|
||||
{{ live_search(target_selector='#sub-areas .govuk-checkboxes__item', show=show_search_form, form=search_form, label='Or by electoral ward') }}
|
||||
|
||||
{{ form.areas }}
|
||||
<div id="sub-areas">
|
||||
{{ form.areas }}
|
||||
</div>
|
||||
|
||||
{{ sticky_page_footer('Add to broadcast') }}
|
||||
|
||||
|
||||
@@ -470,21 +470,33 @@ def test_choose_broadcast_sub_area_page(
|
||||
'Choose an area of Aberdeen City'
|
||||
)
|
||||
live_search = page.select_one("[data-module=live-search]")
|
||||
assert live_search['data-targets'] == '.govuk-checkboxes__item'
|
||||
assert live_search['data-targets'] == '#sub-areas .govuk-checkboxes__item'
|
||||
assert live_search.select_one('input')['type'] == 'search'
|
||||
choices = [
|
||||
all_choices = [
|
||||
(
|
||||
choice.select_one('input')['value'],
|
||||
normalize_spaces(choice.select_one('label').text),
|
||||
)
|
||||
for choice in page.select('form[method=post] .govuk-checkboxes__item')
|
||||
]
|
||||
assert choices[:3] == [
|
||||
sub_choices = [
|
||||
(
|
||||
choice.select_one('input')['value'],
|
||||
normalize_spaces(choice.select_one('label').text),
|
||||
)
|
||||
for choice in page.select('form[method=post] #sub-areas .govuk-checkboxes__item')
|
||||
]
|
||||
assert all_choices[:3] == [
|
||||
('y', 'All of Aberdeen City'),
|
||||
('wd20-S13002845', 'Airyhall/Broomhill/Garthdee'),
|
||||
('wd20-S13002836', 'Bridge of Don'),
|
||||
]
|
||||
assert choices[-1:] == [
|
||||
assert sub_choices[:3] == [
|
||||
('wd20-S13002845', 'Airyhall/Broomhill/Garthdee'),
|
||||
('wd20-S13002836', 'Bridge of Don'),
|
||||
('wd20-S13002835', 'Dyce/Bucksburn/Danestone'),
|
||||
]
|
||||
assert all_choices[-1:] == sub_choices[-1:] == [
|
||||
('wd20-S13002846', 'Torry/Ferryhill'),
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user