diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index 21e748d33..6d90f47c3 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -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, diff --git a/tests/conftest.py b/tests/conftest.py index efacd630d..347ae250f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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):