From 4946bed5ccb55d2fcd16786780d8c7abd22d6b2f Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Tue, 3 Dec 2024 13:05:55 -0800 Subject: [PATCH] fixed title testing --- app/templates/base.html | 4 +--- app/templates/views/templates/choose.html | 4 +--- app/templates/withnav_template.html | 9 ++------- tests/app/main/views/test_template_folders.py | 13 +++++++------ 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/app/templates/base.html b/app/templates/base.html index b2b6639e9..0348832bd 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -6,9 +6,7 @@ - {% block pageTitle %} - {% block per_page_title %}{% endblock %} – Notify.gov - {% endblock %} + {% block pageTitle %}{% block per_page_title %}{% endblock %} – Notify.gov{% endblock %} {% include "components/head.html" %} diff --git a/app/templates/views/templates/choose.html b/app/templates/views/templates/choose.html index 428ea7c8f..5813a361f 100644 --- a/app/templates/views/templates/choose.html +++ b/app/templates/views/templates/choose.html @@ -10,9 +10,7 @@ {% set page_title = 'Select or create a template' %} -{% block service_page_title %} - {{page_title}} -{% endblock %} +{% block service_page_title %}{{page_title}}{% endblock %} {% block maincolumn_content %} diff --git a/app/templates/withnav_template.html b/app/templates/withnav_template.html index eb6a42244..d7a249562 100644 --- a/app/templates/withnav_template.html +++ b/app/templates/withnav_template.html @@ -1,12 +1,7 @@ {% extends "base.html" %} -{% block per_page_title %} - {% if current_org.name %} - {% block org_page_title %}{% endblock %} – {{ current_org.name }} - {% else %} - {% block service_page_title %}{% endblock %} – {{ current_service.name }} - {% endif %} -{% endblock %} +{% block per_page_title %}{% if current_org.name %}{% block org_page_title %}{% endblock %} – {{ current_org.name }}{% + else %}{% block service_page_title %}{% endblock %} – {{ current_service.name }}{% endif %}{% endblock %} {% block main %}
diff --git a/tests/app/main/views/test_template_folders.py b/tests/app/main/views/test_template_folders.py index f439cae18..574bf62e6 100644 --- a/tests/app/main/views/test_template_folders.py +++ b/tests/app/main/views/test_template_folders.py @@ -41,8 +41,8 @@ def _folder(name, folder_id=None, parent=None, users_with_permission=None): @pytest.mark.parametrize( ( - "expected_title_tag", "expected_page_title", + "expected_title_tag", "expected_parent_link_args", "extra_args", "expected_nav_links", @@ -54,7 +54,7 @@ def _folder(name, folder_id=None, parent=None, users_with_permission=None): [ ( "Select or create a template – service one – Notify.gov", - "Templates", + "Select or create a template", [], {}, ["Email", "Text message"], @@ -93,7 +93,7 @@ def _folder(name, folder_id=None, parent=None, users_with_permission=None): ), ( "Select or create a template – service one – Notify.gov", - "Templates", + "Select or create a template", [], {"template_type": "all"}, ["Email", "Text message"], @@ -132,7 +132,7 @@ def _folder(name, folder_id=None, parent=None, users_with_permission=None): ), ( "Select or create a template – service one – Notify.gov", - "Templates", + "Select or create a template", [], {"template_type": "sms"}, ["All", "Email"], @@ -346,8 +346,9 @@ def test_should_show_templates_folder_page( **extra_args, ) - assert normalize_spaces(page.select_one("title").text) == expected_title_tag - assert normalize_spaces(page.select_one("h2").text) == expected_page_title + + assert normalize_spaces(page.select_one("title").text) == expected_page_title + assert normalize_spaces(page.select_one("h1").text) == expected_title_tag assert len(page.select("h2 a")) == len(expected_parent_link_args)