mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-14 10:58:58 -04:00
Add test for live-search on templates page
Includes addition of a mock for a list of templates long enough to need a live-search.
This commit is contained in:
@@ -147,6 +147,32 @@ def test_should_not_show_template_nav_if_only_one_type_of_template(
|
||||
assert not page.select('.pill')
|
||||
|
||||
|
||||
def test_should_not_show_live_search_if_list_of_templates_fits_onscreen(
|
||||
client_request,
|
||||
mock_get_service_templates
|
||||
):
|
||||
|
||||
page = client_request.get(
|
||||
'main.choose_template',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
)
|
||||
|
||||
assert not page.select('.live-search')
|
||||
|
||||
|
||||
def test_should_show_live_search_if_list_of_templates_taller_than_screen(
|
||||
client_request,
|
||||
mock_get_more_service_templates_than_can_fit_onscreen
|
||||
):
|
||||
|
||||
page = client_request.get(
|
||||
'main.choose_template',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
)
|
||||
|
||||
assert page.select('.live-search')
|
||||
|
||||
|
||||
def test_should_show_page_for_one_template(
|
||||
logged_in_client,
|
||||
mock_get_service_template,
|
||||
|
||||
@@ -987,6 +987,16 @@ def mock_get_service_templates(mocker):
|
||||
side_effect=_create)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_get_more_service_templates_than_can_fit_onscreen(mocker):
|
||||
def _create(service_id):
|
||||
return create_service_templates(service_id, number_of_templates=10)
|
||||
|
||||
return mocker.patch(
|
||||
'app.service_api_client.get_service_templates',
|
||||
side_effect=_create)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_get_service_templates_when_no_templates_exist(mocker):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user