From c893eacf975f2a3d31ec63cfe01011475ae98fc2 Mon Sep 17 00:00:00 2001 From: VirajP1002 Date: Tue, 27 Aug 2024 15:14:37 +0100 Subject: [PATCH 01/26] Update component used in listcollectorcontent templaye --- .design-system-version | 2 +- app/jinja_filters.py | 27 +++++++++++++++++++++++++++ templates/listcollectorcontent.html | 19 +++++++++++++++++-- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/.design-system-version b/.design-system-version index 14a228fe9a..b4c6e5997e 100644 --- a/.design-system-version +++ b/.design-system-version @@ -1 +1 @@ -70.0.5 +70.0.11 diff --git a/app/jinja_filters.py b/app/jinja_filters.py index 29d8af10df..fffac16c4b 100644 --- a/app/jinja_filters.py +++ b/app/jinja_filters.py @@ -648,6 +648,33 @@ def map_summary_item_config_processor() -> dict[str, Callable]: return {"map_summary_item_config": map_summary_item_config} +@blueprint.app_context_processor +def map_list_config_processor() -> dict[str, Callable]: + return {"map_list_config": map_list_config} + + +@blueprint.app_template_filter() +def map_list_config(list_values: list[dict[str, str | bool]]) -> list[dict[str, str]]: + items_list: list[dict[str, str]] = [] + + for index, value in enumerate(list_values): + item = {"text": value["item_title"]} + + if value["is_complete"]: + item["iconType"] = "check" + else: + value.pop("iconType", None) + + value["attributes"] = { + "data-qa": f"list-item-{index}-label", + "data-list-item-id": value.get("list_item_id"), + } + + items_list.append(item) + + return items_list + + # pylint: disable=too-many-locals @blueprint.app_template_filter() def map_list_collector_config( diff --git a/templates/listcollectorcontent.html b/templates/listcollectorcontent.html index e98068d486..09d80630da 100644 --- a/templates/listcollectorcontent.html +++ b/templates/listcollectorcontent.html @@ -2,6 +2,8 @@ {% import "macros/helpers.html" as helpers %} +{% from "components/list/_macro.njk" import onsList %} + {% set save_on_signout = true %} {% set continue_button_text = _("Continue") %} {% set title = content.title %} @@ -10,8 +12,21 @@ {% block form_content %}

{{ title }}

{%- if content.list and content.list.list_items -%} - {% set list = content.list %} -
{% include "partials/summary/list-summary.html" %}
+ {% set list = content.list.list_items %} +
+ {# djlint:off #} + {% + set items = map_list_config(list) + %} + {{ + onsList({ + "variants": "summary", + "iconPosition": "before", + "itemsList": items + }) + }} + {# djlint:on #} +
{%- endif -%} {% include "partials/contents.html" %} {% endblock form_content %} From 1c1976b0e94a47175c5557cf9b6266bdaf430b22 Mon Sep 17 00:00:00 2001 From: VirajP1002 Date: Fri, 30 Aug 2024 09:59:52 +0100 Subject: [PATCH 02/26] Refactor variables --- app/jinja_filters.py | 4 +--- templates/listcollectorcontent.html | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/jinja_filters.py b/app/jinja_filters.py index fffac16c4b..40fff53920 100644 --- a/app/jinja_filters.py +++ b/app/jinja_filters.py @@ -662,10 +662,8 @@ def map_list_config(list_values: list[dict[str, str | bool]]) -> list[dict[str, if value["is_complete"]: item["iconType"] = "check" - else: - value.pop("iconType", None) - value["attributes"] = { + item["attributes"] = { "data-qa": f"list-item-{index}-label", "data-list-item-id": value.get("list_item_id"), } diff --git a/templates/listcollectorcontent.html b/templates/listcollectorcontent.html index 09d80630da..1dcf812295 100644 --- a/templates/listcollectorcontent.html +++ b/templates/listcollectorcontent.html @@ -16,15 +16,15 @@

{{ title }}

{# djlint:off #} {% - set items = map_list_config(list) + set itemsList = map_list_config(list) %} {{ onsList({ "variants": "summary", "iconPosition": "before", - "itemsList": items + "itemsList": itemsList, }) - }} + }} {# djlint:on #}
{%- endif -%} From 2fc1fbde9dac2ed9017b50793780df8109fa90b8 Mon Sep 17 00:00:00 2001 From: VirajP1002 Date: Fri, 30 Aug 2024 13:59:12 +0100 Subject: [PATCH 03/26] Update design system --- .design-system-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.design-system-version b/.design-system-version index b4c6e5997e..0773c578b5 100644 --- a/.design-system-version +++ b/.design-system-version @@ -1 +1 @@ -70.0.11 +70.0.12 From 67feb7fd395c29af81c316dcbfc6c6ba036e93f5 Mon Sep 17 00:00:00 2001 From: VirajP1002 Date: Fri, 30 Aug 2024 16:55:04 +0100 Subject: [PATCH 04/26] Update type hints and format --- app/jinja_filters.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/jinja_filters.py b/app/jinja_filters.py index 40fff53920..32d3330484 100644 --- a/app/jinja_filters.py +++ b/app/jinja_filters.py @@ -654,18 +654,22 @@ def map_list_config_processor() -> dict[str, Callable]: @blueprint.app_template_filter() -def map_list_config(list_values: list[dict[str, str | bool]]) -> list[dict[str, str]]: - items_list: list[dict[str, str]] = [] +def map_list_config( + list_values: list[dict[str, str | bool]] +) -> list[dict[str, str | bool | dict[str, str | bool]]]: + items_list: list[dict[str, str | bool | dict[str, str | bool]]] = [] for index, value in enumerate(list_values): - item = {"text": value["item_title"]} + item: dict[str, str | bool | dict[str, str | bool]] = { + "text": value["item_title"] + } if value["is_complete"]: item["iconType"] = "check" item["attributes"] = { "data-qa": f"list-item-{index}-label", - "data-list-item-id": value.get("list_item_id"), + "data-list-item-id": value["list_item_id"], } items_list.append(item) From 94fd2800a390ed4f8f41f81b13b0967c052af093 Mon Sep 17 00:00:00 2001 From: VirajP1002 Date: Fri, 30 Aug 2024 17:00:50 +0100 Subject: [PATCH 05/26] Update type hints to adhere to standards --- app/jinja_filters.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/jinja_filters.py b/app/jinja_filters.py index 32d3330484..495b14ab8d 100644 --- a/app/jinja_filters.py +++ b/app/jinja_filters.py @@ -654,15 +654,11 @@ def map_list_config_processor() -> dict[str, Callable]: @blueprint.app_template_filter() -def map_list_config( - list_values: list[dict[str, str | bool]] -) -> list[dict[str, str | bool | dict[str, str | bool]]]: - items_list: list[dict[str, str | bool | dict[str, str | bool]]] = [] +def map_list_config(list_values: list[dict]) -> list[dict]: + items_list: list[dict] = [] for index, value in enumerate(list_values): - item: dict[str, str | bool | dict[str, str | bool]] = { - "text": value["item_title"] - } + item: dict = {"text": value["item_title"]} if value["is_complete"]: item["iconType"] = "check" From dbd6e78f3492ffefa73b91b6c11ccc9f8925fd1b Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Tue, 3 Sep 2024 15:01:46 +0100 Subject: [PATCH 06/26] formatting --- templates/listcollectorcontent.html | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/templates/listcollectorcontent.html b/templates/listcollectorcontent.html index 1dcf812295..e7a23f646e 100644 --- a/templates/listcollectorcontent.html +++ b/templates/listcollectorcontent.html @@ -15,16 +15,14 @@

{{ title }}

{% set list = content.list.list_items %}
{# djlint:off #} - {% - set itemsList = map_list_config(list) - %} + {% set itemsList = map_list_config(list) %} {{ - onsList({ - "variants": "summary", - "iconPosition": "before", - "itemsList": itemsList, - }) - }} + onsList({ + "variants": "summary", + "iconPosition": "before", + "itemsList": itemsList, + }) + }} {# djlint:on #}
{%- endif -%} From 42bdcfbbc821f0a747c413ac4cc4580533b82986 Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Wed, 4 Sep 2024 15:55:15 +0100 Subject: [PATCH 07/26] fix tests --- app/jinja_filters.py | 4 ++-- tests/functional/spec/list_collector_content.spec.js | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/jinja_filters.py b/app/jinja_filters.py index 495b14ab8d..6780478b7f 100644 --- a/app/jinja_filters.py +++ b/app/jinja_filters.py @@ -657,7 +657,7 @@ def map_list_config_processor() -> dict[str, Callable]: def map_list_config(list_values: list[dict]) -> list[dict]: items_list: list[dict] = [] - for index, value in enumerate(list_values): + for index, value in enumerate(list_values, 1): item: dict = {"text": value["item_title"]} if value["is_complete"]: @@ -690,7 +690,7 @@ def map_list_collector_config( ) -> list[dict[str, list] | SummaryRow]: rows: list[dict[str, list] | SummaryRow] = [] - for index, list_item in enumerate(list_items, start=1): + for index, list_item in enumerate(list_items, 1): item_name = str(list_item.get("item_title")) actions = [] diff --git a/tests/functional/spec/list_collector_content.spec.js b/tests/functional/spec/list_collector_content.spec.js index 5c211c89fb..4880d53319 100644 --- a/tests/functional/spec/list_collector_content.spec.js +++ b/tests/functional/spec/list_collector_content.spec.js @@ -92,13 +92,13 @@ describe("List Collector Section Summary and Summary Items", () => { await expect(await $(HubPage.summaryRowState("section-list-collector-contents")).getText()).toBe("Partially completed"); await click(HubPage.submit()); await expect(browser).toHaveUrlContaining(ListCollectorContentPage.pageName); - await checkListItemComplete(`dt[data-qa="list-item-1-label"]`); - await checkListItemComplete(`dt[data-qa="list-item-2-label"]`); - await checkListItemIncomplete(`dt[data-qa="list-item-3-label"]`); + await checkListItemComplete(`li[data-qa="list-item-1-label"]`); + await checkListItemComplete(`li[data-qa="list-item-2-label"]`); + await checkListItemIncomplete(`li[data-qa="list-item-3-label"]`); await click(ListCollectorContentPage.submit()); await expect(browser).toHaveUrlContaining(ListCollectorFirstRepeatingBlockPage.pageName); await completeRepeatingBlocks(666, 2, 5, 1995, true, true); - await checkListItemComplete(`dt[data-qa="list-item-3-label"]`); + await checkListItemComplete(`li[data-qa="list-item-3-label"]`); await click(ListCollectorContentPage.submit()); await click(ListCollectorContentSectionSummaryPage.submit()); await expect(await $(HubPage.summaryRowState("section-list-collector-contents")).getText()).toBe("Completed"); @@ -114,7 +114,7 @@ describe("List Collector Section Summary and Summary Items", () => { await click(CompaniesSummaryPage.submit()); await expect(await $(HubPage.summaryRowState("section-list-collector-contents")).getText()).toBe("Partially completed"); await click(HubPage.submit()); - await checkListItemComplete(`dt[data-qa="list-item-1-label"]`); + await checkListItemComplete(`p[data-qa="list-item-1-label"]`); await click(ListCollectorContentPage.submit()); await expect(browser).toHaveUrlContaining(ListCollectorContentSectionSummaryPage.pageName); await click(ListCollectorContentSectionSummaryPage.submit()); From be4c962289044539aea6bcd631e6a3caba0d33e4 Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Wed, 4 Sep 2024 16:42:59 +0100 Subject: [PATCH 08/26] fix tests --- tests/functional/helpers.js | 15 +++++++++---- .../list_collector_repeating_blocks.spec.js | 22 +++++++++---------- .../supplementary_data.spec.js | 8 +++---- .../spec/list_collector_content.spec.js | 12 +++++----- 4 files changed, 32 insertions(+), 25 deletions(-) diff --git a/tests/functional/helpers.js b/tests/functional/helpers.js index c0fa90daae..a65f8b4f45 100644 --- a/tests/functional/helpers.js +++ b/tests/functional/helpers.js @@ -6,11 +6,18 @@ export const checkItemsInList = async (itemsExpected, listLabel) => { } }; -export const checkListItemComplete = async (listItemLabel) => { - await expect(await $(listItemLabel).$(`.ons-summary__item-title-icon.ons-summary__item-title-icon--check`).isExisting()).toBe(true); +export const summaryItemComplete = async (summaryItemLabel) => { + await expect(await $(summaryItemLabel).$(`.ons-summary__item-title-icon.ons-summary__item-title-icon--check`).isExisting()).toBe(true); }; -export const checkListItemIncomplete = async (listItemLabel) => { - await expect(await $(listItemLabel).$(`.ons-summary__item-title-icon.ons-summary__item-title-icon--check`).isExisting()).toBe(false); +export const summaryItemIncomplete = async (summaryItemLabel) => { + await expect(await $(summaryItemLabel).$(`.ons-summary__item-title-icon.ons-summary__item-title-icon--check`).isExisting()).toBe(false); +}; + +export const listItemComplete = async (listItemLabel) => { + await expect(await $(listItemLabel).$(`.ons-list__prefix.ons-list__prefix--icon-check`).isExisting()).toBe(true); +}; +export const listItemIncomplete = async (listItemLabel) => { + await expect(await $(listItemLabel).$(`.ons-list__prefix.ons-list__prefix--icon-check`).isExisting()).toBe(false); }; const assertSummaryFunction = (selector) => { diff --git a/tests/functional/spec/features/repeating_blocks/list_collector_repeating_blocks.spec.js b/tests/functional/spec/features/repeating_blocks/list_collector_repeating_blocks.spec.js index 4e2fcd403c..1ec423ed1b 100644 --- a/tests/functional/spec/features/repeating_blocks/list_collector_repeating_blocks.spec.js +++ b/tests/functional/spec/features/repeating_blocks/list_collector_repeating_blocks.spec.js @@ -9,7 +9,7 @@ import AnyOtherCompaniesOrBranchesPage from "../../../generated_pages/list_colle import SectionCompaniesPage from "../../../generated_pages/list_collector_repeating_blocks_section_summary/section-companies-summary.page"; import AnyOtherTradingDetailsPage from "../../../generated_pages/list_collector_repeating_blocks_section_summary/any-other-trading-details.page"; import SubmitPage from "../../../generated_pages/list_collector_repeating_blocks_section_summary/submit.page"; -import { repeatingAnswerChangeLink, checkItemsInList, checkListItemComplete, checkListItemIncomplete, click } from "../../../helpers"; +import { repeatingAnswerChangeLink, checkItemsInList, summaryItemComplete, summaryItemIncomplete, click } from "../../../helpers"; import HubPage from "../../../base_pages/hub.page"; import ResponsiblePartyHubPage from "../../../generated_pages/list_collector_repeating_blocks_with_hub/responsible-party-business.page"; import { expect } from "@wdio/globals"; @@ -159,10 +159,10 @@ describe("List Collector Repeating Blocks", () => { // Only the ONS and NAV items should be complete await checkItemsInList(["ONS", "GOV", "MOD", "NAV"], AnyOtherCompaniesOrBranchesPage.listLabel); - await checkListItemComplete(`dt[data-qa="list-item-1-label"]`); - await checkListItemIncomplete(`dt[data-qa="list-item-2-label"]`); - await checkListItemIncomplete(`dt[data-qa="list-item-3-label"]`); - await checkListItemComplete(`dt[data-qa="list-item-1-label"]`); + await summaryItemComplete(`dt[data-qa="list-item-1-label"]`); + await summaryItemIncomplete(`dt[data-qa="list-item-2-label"]`); + await summaryItemIncomplete(`dt[data-qa="list-item-3-label"]`); + await summaryItemComplete(`dt[data-qa="list-item-1-label"]`); }); it("When an item has incomplete repeating blocks, Then using submit on the list collector page will navigate the user to the first incomplete repeating block.", async () => { @@ -192,10 +192,10 @@ describe("List Collector Repeating Blocks", () => { it("When the last remaining incomplete repeating block is completed, Then all items are marked as completed with the checkmark icon.", async () => { await $(CompaniesRepeatingBlock2Page.authorisedTraderUkRadioNo()).click(); await click(CompaniesRepeatingBlock2Page.submit()); - await checkListItemComplete(`dt[data-qa="list-item-1-label"]`); - await checkListItemComplete(`dt[data-qa="list-item-2-label"]`); - await checkListItemComplete(`dt[data-qa="list-item-3-label"]`); - await checkListItemComplete(`dt[data-qa="list-item-4-label"]`); + await summaryItemComplete(`dt[data-qa="list-item-1-label"]`); + await summaryItemComplete(`dt[data-qa="list-item-2-label"]`); + await summaryItemComplete(`dt[data-qa="list-item-3-label"]`); + await summaryItemComplete(`dt[data-qa="list-item-4-label"]`); }); it("When the user clicks a change link from the section summary and submits without changing an answer, Then the user is returned to the section summary anchored to the answer they clicked on", async () => { @@ -304,8 +304,8 @@ describe("List Collector Repeating Blocks", () => { await $(CompaniesRepeatingBlock2Page.authorisedTraderUkRadioNo()).click(); await click(CompaniesRepeatingBlock2Page.submit()); await expect(browser).toHaveUrlContaining(AnyOtherCompaniesOrBranchesPage.pageName); - await checkListItemComplete(`dt[data-qa="list-item-1-label"]`); - await checkListItemComplete(`dt[data-qa="list-item-2-label"]`); + await summaryItemComplete(`dt[data-qa="list-item-1-label"]`); + await summaryItemComplete(`dt[data-qa="list-item-2-label"]`); }); it("When another incomplete item is added via the section summary, Then navigating to the submit page of the section will redirect to the list collector page.", async () => { diff --git a/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js b/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js index dbb1344588..891e3b9841 100644 --- a/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js +++ b/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js @@ -1,4 +1,4 @@ -import { assertSummaryItems, assertSummaryTitles, assertSummaryValues, checkListItemComplete, checkListItemIncomplete, click } from "../../../helpers"; +import { assertSummaryItems, assertSummaryTitles, assertSummaryValues, summaryItemComplete, summaryItemIncomplete, click } from "../../../helpers"; import { expect } from "@wdio/globals"; import { getRandomString } from "../../../jwt_helper"; import AddAdditionalEmployeePage from "../../../generated_pages/supplementary_data/list-collector-additional-add.page.js"; @@ -370,9 +370,9 @@ describe("Using supplementary data", () => { it("Given there is now an additional product, When I resume the Product Details Section, Then I start from the list collector content block and see the new product is incomplete", async () => { await $(HubPage.summaryRowLink("section-6")).click(); await expect(browser).toHaveUrlContaining(ListCollectorProductsPage.pageName); - await checkListItemComplete(`dt[data-qa="list-item-1-label"]`); - await checkListItemComplete(`dt[data-qa="list-item-2-label"]`); - await checkListItemIncomplete(`dt[data-qa="list-item-3-label"]`); + await summaryItemComplete(`dt[data-qa="list-item-1-label"]`); + await summaryItemComplete(`dt[data-qa="list-item-2-label"]`); + await summaryItemIncomplete(`dt[data-qa="list-item-3-label"]`); await click(ListCollectorProductsPage.submit()); await expect(browser).toHaveUrlContaining(ProductRepeatingBlock1Page.pageName); }); diff --git a/tests/functional/spec/list_collector_content.spec.js b/tests/functional/spec/list_collector_content.spec.js index 4880d53319..2a22e36969 100644 --- a/tests/functional/spec/list_collector_content.spec.js +++ b/tests/functional/spec/list_collector_content.spec.js @@ -11,7 +11,7 @@ import ListCollectorSecondRepeatingBlockPage from "../generated_pages/list_colle import ListCollectorContentPage from "../generated_pages/list_collector_content_page/list-collector-content.page"; import ListCollectorContentSectionSummaryPage from "../generated_pages/list_collector_content_page/section-list-collector-contents-summary.page"; import ConfirmationCheckboxPage from "../generated_pages/list_collector_content_page/confirmation-checkbox.page"; -import { checkListItemComplete, checkListItemIncomplete, click } from "../helpers"; +import { listItemComplete, listItemIncomplete, click } from "../helpers"; describe("List Collector Section Summary and Summary Items", () => { describe("Given I launch the test list collector section summary items survey", () => { @@ -92,13 +92,13 @@ describe("List Collector Section Summary and Summary Items", () => { await expect(await $(HubPage.summaryRowState("section-list-collector-contents")).getText()).toBe("Partially completed"); await click(HubPage.submit()); await expect(browser).toHaveUrlContaining(ListCollectorContentPage.pageName); - await checkListItemComplete(`li[data-qa="list-item-1-label"]`); - await checkListItemComplete(`li[data-qa="list-item-2-label"]`); - await checkListItemIncomplete(`li[data-qa="list-item-3-label"]`); + await listItemComplete(`li[data-qa="list-item-1-label"]`); + await listItemComplete(`li[data-qa="list-item-2-label"]`); + await listItemIncomplete(`li[data-qa="list-item-3-label"]`); await click(ListCollectorContentPage.submit()); await expect(browser).toHaveUrlContaining(ListCollectorFirstRepeatingBlockPage.pageName); await completeRepeatingBlocks(666, 2, 5, 1995, true, true); - await checkListItemComplete(`li[data-qa="list-item-3-label"]`); + await listItemComplete(`li[data-qa="list-item-3-label"]`); await click(ListCollectorContentPage.submit()); await click(ListCollectorContentSectionSummaryPage.submit()); await expect(await $(HubPage.summaryRowState("section-list-collector-contents")).getText()).toBe("Completed"); @@ -114,7 +114,7 @@ describe("List Collector Section Summary and Summary Items", () => { await click(CompaniesSummaryPage.submit()); await expect(await $(HubPage.summaryRowState("section-list-collector-contents")).getText()).toBe("Partially completed"); await click(HubPage.submit()); - await checkListItemComplete(`p[data-qa="list-item-1-label"]`); + await listItemComplete(`p[data-qa="list-item-1-label"]`); await click(ListCollectorContentPage.submit()); await expect(browser).toHaveUrlContaining(ListCollectorContentSectionSummaryPage.pageName); await click(ListCollectorContentSectionSummaryPage.submit()); From ce4164c54cfa1f663c469c6d6333fa45ea897813 Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Fri, 6 Sep 2024 11:45:48 +0100 Subject: [PATCH 09/26] update ds version --- .design-system-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.design-system-version b/.design-system-version index 0773c578b5..91fddd177b 100644 --- a/.design-system-version +++ b/.design-system-version @@ -1 +1 @@ -70.0.12 +70.0.13 From 11ffc9d720c99e55a26fba9be911057b21f45506 Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Mon, 9 Sep 2024 17:02:44 +0100 Subject: [PATCH 10/26] update to ds 70.0.14 --- .design-system-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.design-system-version b/.design-system-version index 91fddd177b..6e1ec597e1 100644 --- a/.design-system-version +++ b/.design-system-version @@ -1 +1 @@ -70.0.13 +70.0.14 From b30e9bb9f3ce2a2d3bf5e135a5c3e131fabf6b57 Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Tue, 10 Sep 2024 16:13:09 +0100 Subject: [PATCH 11/26] update ds version --- .design-system-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.design-system-version b/.design-system-version index 6e1ec597e1..3b74fa7060 100644 --- a/.design-system-version +++ b/.design-system-version @@ -1 +1 @@ -70.0.14 +70.0.15 From c7b8e4aea657e87119604c8289a29053c599f3d2 Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Tue, 10 Sep 2024 16:49:35 +0100 Subject: [PATCH 12/26] update test --- tests/functional/spec/list_collector_content.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/spec/list_collector_content.spec.js b/tests/functional/spec/list_collector_content.spec.js index 2a22e36969..60209b3c25 100644 --- a/tests/functional/spec/list_collector_content.spec.js +++ b/tests/functional/spec/list_collector_content.spec.js @@ -114,7 +114,7 @@ describe("List Collector Section Summary and Summary Items", () => { await click(CompaniesSummaryPage.submit()); await expect(await $(HubPage.summaryRowState("section-list-collector-contents")).getText()).toBe("Partially completed"); await click(HubPage.submit()); - await listItemComplete(`p[data-qa="list-item-1-label"]`); + await listItemComplete(`li[data-qa="list-item-1-label"]`); await click(ListCollectorContentPage.submit()); await expect(browser).toHaveUrlContaining(ListCollectorContentSectionSummaryPage.pageName); await click(ListCollectorContentSectionSummaryPage.submit()); From f99e6e97ef5fe5d9f347fc756ddd9f439dc7180f Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Tue, 10 Sep 2024 19:45:27 +0100 Subject: [PATCH 13/26] remove ds version change --- .design-system-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.design-system-version b/.design-system-version index 3b74fa7060..126f773e3d 100644 --- a/.design-system-version +++ b/.design-system-version @@ -1 +1 @@ -70.0.15 +70.0.05 From adfc77f7b9df4452bbee231074c5be140ad29b93 Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Tue, 10 Sep 2024 19:46:02 +0100 Subject: [PATCH 14/26] typo --- .design-system-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.design-system-version b/.design-system-version index 126f773e3d..14a228fe9a 100644 --- a/.design-system-version +++ b/.design-system-version @@ -1 +1 @@ -70.0.05 +70.0.5 From feb8b107c46916253ddea306cc1f187ed741c47a Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Mon, 16 Sep 2024 13:25:19 +0100 Subject: [PATCH 15/26] fix tests --- .../features/supplementary_data/supplementary_data.spec.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js b/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js index 891e3b9841..3486429db4 100644 --- a/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js +++ b/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js @@ -370,9 +370,9 @@ describe("Using supplementary data", () => { it("Given there is now an additional product, When I resume the Product Details Section, Then I start from the list collector content block and see the new product is incomplete", async () => { await $(HubPage.summaryRowLink("section-6")).click(); await expect(browser).toHaveUrlContaining(ListCollectorProductsPage.pageName); - await summaryItemComplete(`dt[data-qa="list-item-1-label"]`); - await summaryItemComplete(`dt[data-qa="list-item-2-label"]`); - await summaryItemIncomplete(`dt[data-qa="list-item-3-label"]`); + await summaryItemComplete(`li[data-qa="list-item-1-label"]`); + await summaryItemComplete(`li[data-qa="list-item-2-label"]`); + await summaryItemIncomplete(`li[data-qa="list-item-3-label"]`); await click(ListCollectorProductsPage.submit()); await expect(browser).toHaveUrlContaining(ProductRepeatingBlock1Page.pageName); }); From 0e95e5da6f5c3ae3389fc4b6cb5a86ce21e00f0a Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Mon, 16 Sep 2024 15:46:55 +0100 Subject: [PATCH 16/26] add await --- .../spec/features/supplementary_data/supplementary_data.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js b/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js index 3486429db4..66be0f6fce 100644 --- a/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js +++ b/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js @@ -374,7 +374,7 @@ describe("Using supplementary data", () => { await summaryItemComplete(`li[data-qa="list-item-2-label"]`); await summaryItemIncomplete(`li[data-qa="list-item-3-label"]`); await click(ListCollectorProductsPage.submit()); - await expect(browser).toHaveUrlContaining(ProductRepeatingBlock1Page.pageName); + await expect(await (browser).toHaveUrlContaining(ProductRepeatingBlock1Page.pageName)); }); it("Given I complete the section and relaunch with the old data that has fewer items in the products list, When I am on the Hub, Then I see the products section and sales targets sections are now in progress", async () => { From 23051462fc6ba931003a4c16457dde1a49a305f2 Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Mon, 16 Sep 2024 15:54:12 +0100 Subject: [PATCH 17/26] format --- .../spec/features/supplementary_data/supplementary_data.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js b/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js index 66be0f6fce..e0d9b949d4 100644 --- a/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js +++ b/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js @@ -374,7 +374,7 @@ describe("Using supplementary data", () => { await summaryItemComplete(`li[data-qa="list-item-2-label"]`); await summaryItemIncomplete(`li[data-qa="list-item-3-label"]`); await click(ListCollectorProductsPage.submit()); - await expect(await (browser).toHaveUrlContaining(ProductRepeatingBlock1Page.pageName)); + await expect(await browser.toHaveUrlContaining(ProductRepeatingBlock1Page.pageName)); }); it("Given I complete the section and relaunch with the old data that has fewer items in the products list, When I am on the Hub, Then I see the products section and sales targets sections are now in progress", async () => { From 35e6398f5ebe5bfd6e6d894deadea7b0445a97ef Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Tue, 17 Sep 2024 11:32:10 +0100 Subject: [PATCH 18/26] update test --- .../supplementary_data/supplementary_data.spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js b/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js index e0d9b949d4..448e70f779 100644 --- a/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js +++ b/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js @@ -1,4 +1,4 @@ -import { assertSummaryItems, assertSummaryTitles, assertSummaryValues, summaryItemComplete, summaryItemIncomplete, click } from "../../../helpers"; +import { assertSummaryItems, assertSummaryTitles, assertSummaryValues, listItemComplete, click } from "../../../helpers"; import { expect } from "@wdio/globals"; import { getRandomString } from "../../../jwt_helper"; import AddAdditionalEmployeePage from "../../../generated_pages/supplementary_data/list-collector-additional-add.page.js"; @@ -370,9 +370,9 @@ describe("Using supplementary data", () => { it("Given there is now an additional product, When I resume the Product Details Section, Then I start from the list collector content block and see the new product is incomplete", async () => { await $(HubPage.summaryRowLink("section-6")).click(); await expect(browser).toHaveUrlContaining(ListCollectorProductsPage.pageName); - await summaryItemComplete(`li[data-qa="list-item-1-label"]`); - await summaryItemComplete(`li[data-qa="list-item-2-label"]`); - await summaryItemIncomplete(`li[data-qa="list-item-3-label"]`); + await listItemComplete(`li[data-qa="list-item-1-label"]`); + await listItemComplete(`li[data-qa="list-item-2-label"]`); + await listItemComplete(`li[data-qa="list-item-3-label"]`); await click(ListCollectorProductsPage.submit()); await expect(await browser.toHaveUrlContaining(ProductRepeatingBlock1Page.pageName)); }); From 7d151f5fc72f2015d485eafd327cb3fc5fc7c2dd Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Tue, 17 Sep 2024 12:08:29 +0100 Subject: [PATCH 19/26] remove incomplete versions of helpers --- tests/functional/helpers.js | 14 ++++-------- .../list_collector_repeating_blocks.spec.js | 22 +++++++++---------- .../supplementary_data.spec.js | 6 ++--- .../spec/list_collector_content.spec.js | 12 +++++----- 4 files changed, 24 insertions(+), 30 deletions(-) diff --git a/tests/functional/helpers.js b/tests/functional/helpers.js index a65f8b4f45..895b1c6feb 100644 --- a/tests/functional/helpers.js +++ b/tests/functional/helpers.js @@ -6,18 +6,12 @@ export const checkItemsInList = async (itemsExpected, listLabel) => { } }; -export const summaryItemComplete = async (summaryItemLabel) => { - await expect(await $(summaryItemLabel).$(`.ons-summary__item-title-icon.ons-summary__item-title-icon--check`).isExisting()).toBe(true); -}; -export const summaryItemIncomplete = async (summaryItemLabel) => { - await expect(await $(summaryItemLabel).$(`.ons-summary__item-title-icon.ons-summary__item-title-icon--check`).isExisting()).toBe(false); +export const summaryItemComplete = async (summaryItemLabel, status) => { + await expect(await $(summaryItemLabel).$(`.ons-summary__item-title-icon.ons-summary__item-title-icon--check`).isExisting()).toBe(status); }; -export const listItemComplete = async (listItemLabel) => { - await expect(await $(listItemLabel).$(`.ons-list__prefix.ons-list__prefix--icon-check`).isExisting()).toBe(true); -}; -export const listItemIncomplete = async (listItemLabel) => { - await expect(await $(listItemLabel).$(`.ons-list__prefix.ons-list__prefix--icon-check`).isExisting()).toBe(false); +export const listItemComplete = async (listItemLabel, status) => { + await expect(await $(listItemLabel).$(`.ons-list__prefix.ons-list__prefix--icon-check`).isExisting()).toBe(status); }; const assertSummaryFunction = (selector) => { diff --git a/tests/functional/spec/features/repeating_blocks/list_collector_repeating_blocks.spec.js b/tests/functional/spec/features/repeating_blocks/list_collector_repeating_blocks.spec.js index 1ec423ed1b..b2578e6111 100644 --- a/tests/functional/spec/features/repeating_blocks/list_collector_repeating_blocks.spec.js +++ b/tests/functional/spec/features/repeating_blocks/list_collector_repeating_blocks.spec.js @@ -9,7 +9,7 @@ import AnyOtherCompaniesOrBranchesPage from "../../../generated_pages/list_colle import SectionCompaniesPage from "../../../generated_pages/list_collector_repeating_blocks_section_summary/section-companies-summary.page"; import AnyOtherTradingDetailsPage from "../../../generated_pages/list_collector_repeating_blocks_section_summary/any-other-trading-details.page"; import SubmitPage from "../../../generated_pages/list_collector_repeating_blocks_section_summary/submit.page"; -import { repeatingAnswerChangeLink, checkItemsInList, summaryItemComplete, summaryItemIncomplete, click } from "../../../helpers"; +import { repeatingAnswerChangeLink, checkItemsInList, summaryItemComplete, click } from "../../../helpers"; import HubPage from "../../../base_pages/hub.page"; import ResponsiblePartyHubPage from "../../../generated_pages/list_collector_repeating_blocks_with_hub/responsible-party-business.page"; import { expect } from "@wdio/globals"; @@ -159,10 +159,10 @@ describe("List Collector Repeating Blocks", () => { // Only the ONS and NAV items should be complete await checkItemsInList(["ONS", "GOV", "MOD", "NAV"], AnyOtherCompaniesOrBranchesPage.listLabel); - await summaryItemComplete(`dt[data-qa="list-item-1-label"]`); - await summaryItemIncomplete(`dt[data-qa="list-item-2-label"]`); - await summaryItemIncomplete(`dt[data-qa="list-item-3-label"]`); - await summaryItemComplete(`dt[data-qa="list-item-1-label"]`); + await summaryItemComplete(`dt[data-qa="list-item-1-label"]`, true); + await summaryItemComplete(`dt[data-qa="list-item-2-label"]`, false); + await summaryItemComplete(`dt[data-qa="list-item-3-label"]`, false); + await summaryItemComplete(`dt[data-qa="list-item-1-label"]`, true); }); it("When an item has incomplete repeating blocks, Then using submit on the list collector page will navigate the user to the first incomplete repeating block.", async () => { @@ -192,10 +192,10 @@ describe("List Collector Repeating Blocks", () => { it("When the last remaining incomplete repeating block is completed, Then all items are marked as completed with the checkmark icon.", async () => { await $(CompaniesRepeatingBlock2Page.authorisedTraderUkRadioNo()).click(); await click(CompaniesRepeatingBlock2Page.submit()); - await summaryItemComplete(`dt[data-qa="list-item-1-label"]`); - await summaryItemComplete(`dt[data-qa="list-item-2-label"]`); - await summaryItemComplete(`dt[data-qa="list-item-3-label"]`); - await summaryItemComplete(`dt[data-qa="list-item-4-label"]`); + await summaryItemComplete(`dt[data-qa="list-item-1-label"]`, true); + await summaryItemComplete(`dt[data-qa="list-item-2-label"]`, true); + await summaryItemComplete(`dt[data-qa="list-item-3-label"]`, true); + await summaryItemComplete(`dt[data-qa="list-item-4-label"]`, true); }); it("When the user clicks a change link from the section summary and submits without changing an answer, Then the user is returned to the section summary anchored to the answer they clicked on", async () => { @@ -304,8 +304,8 @@ describe("List Collector Repeating Blocks", () => { await $(CompaniesRepeatingBlock2Page.authorisedTraderUkRadioNo()).click(); await click(CompaniesRepeatingBlock2Page.submit()); await expect(browser).toHaveUrlContaining(AnyOtherCompaniesOrBranchesPage.pageName); - await summaryItemComplete(`dt[data-qa="list-item-1-label"]`); - await summaryItemComplete(`dt[data-qa="list-item-2-label"]`); + await summaryItemComplete(`dt[data-qa="list-item-1-label"]`, true); + await summaryItemComplete(`dt[data-qa="list-item-2-label"]`, true); }); it("When another incomplete item is added via the section summary, Then navigating to the submit page of the section will redirect to the list collector page.", async () => { diff --git a/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js b/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js index 448e70f779..15ba8beb3c 100644 --- a/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js +++ b/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js @@ -370,9 +370,9 @@ describe("Using supplementary data", () => { it("Given there is now an additional product, When I resume the Product Details Section, Then I start from the list collector content block and see the new product is incomplete", async () => { await $(HubPage.summaryRowLink("section-6")).click(); await expect(browser).toHaveUrlContaining(ListCollectorProductsPage.pageName); - await listItemComplete(`li[data-qa="list-item-1-label"]`); - await listItemComplete(`li[data-qa="list-item-2-label"]`); - await listItemComplete(`li[data-qa="list-item-3-label"]`); + await listItemComplete(`li[data-qa="list-item-1-label"]`, true); + await listItemComplete(`li[data-qa="list-item-2-label"]`, true); + await listItemComplete(`li[data-qa="list-item-3-label"]`, true); await click(ListCollectorProductsPage.submit()); await expect(await browser.toHaveUrlContaining(ProductRepeatingBlock1Page.pageName)); }); diff --git a/tests/functional/spec/list_collector_content.spec.js b/tests/functional/spec/list_collector_content.spec.js index 60209b3c25..b4a6977c1a 100644 --- a/tests/functional/spec/list_collector_content.spec.js +++ b/tests/functional/spec/list_collector_content.spec.js @@ -11,7 +11,7 @@ import ListCollectorSecondRepeatingBlockPage from "../generated_pages/list_colle import ListCollectorContentPage from "../generated_pages/list_collector_content_page/list-collector-content.page"; import ListCollectorContentSectionSummaryPage from "../generated_pages/list_collector_content_page/section-list-collector-contents-summary.page"; import ConfirmationCheckboxPage from "../generated_pages/list_collector_content_page/confirmation-checkbox.page"; -import { listItemComplete, listItemIncomplete, click } from "../helpers"; +import { listItemComplete, click } from "../helpers"; describe("List Collector Section Summary and Summary Items", () => { describe("Given I launch the test list collector section summary items survey", () => { @@ -92,13 +92,13 @@ describe("List Collector Section Summary and Summary Items", () => { await expect(await $(HubPage.summaryRowState("section-list-collector-contents")).getText()).toBe("Partially completed"); await click(HubPage.submit()); await expect(browser).toHaveUrlContaining(ListCollectorContentPage.pageName); - await listItemComplete(`li[data-qa="list-item-1-label"]`); - await listItemComplete(`li[data-qa="list-item-2-label"]`); - await listItemIncomplete(`li[data-qa="list-item-3-label"]`); + await listItemComplete(`li[data-qa="list-item-1-label"]`, true); + await listItemComplete(`li[data-qa="list-item-2-label"]`, true); + await listItemComplete(`li[data-qa="list-item-3-label"]`, false); await click(ListCollectorContentPage.submit()); await expect(browser).toHaveUrlContaining(ListCollectorFirstRepeatingBlockPage.pageName); await completeRepeatingBlocks(666, 2, 5, 1995, true, true); - await listItemComplete(`li[data-qa="list-item-3-label"]`); + await listItemComplete(`li[data-qa="list-item-3-label"]`, true); await click(ListCollectorContentPage.submit()); await click(ListCollectorContentSectionSummaryPage.submit()); await expect(await $(HubPage.summaryRowState("section-list-collector-contents")).getText()).toBe("Completed"); @@ -114,7 +114,7 @@ describe("List Collector Section Summary and Summary Items", () => { await click(CompaniesSummaryPage.submit()); await expect(await $(HubPage.summaryRowState("section-list-collector-contents")).getText()).toBe("Partially completed"); await click(HubPage.submit()); - await listItemComplete(`li[data-qa="list-item-1-label"]`); + await listItemComplete(`li[data-qa="list-item-1-label"]`, true); await click(ListCollectorContentPage.submit()); await expect(browser).toHaveUrlContaining(ListCollectorContentSectionSummaryPage.pageName); await click(ListCollectorContentSectionSummaryPage.submit()); From 4289f98f0c9f3416d0ba2927d54c636eec7c598b Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Tue, 17 Sep 2024 15:00:09 +0100 Subject: [PATCH 20/26] update ds version --- .design-system-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.design-system-version b/.design-system-version index 3b74fa7060..10f98a1349 100644 --- a/.design-system-version +++ b/.design-system-version @@ -1 +1 @@ -70.0.15 +70.0.16 From eaa7e7342e36f6c01a4d58838af321f9a8cb7c15 Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Tue, 17 Sep 2024 16:06:59 +0100 Subject: [PATCH 21/26] fix test --- .../features/supplementary_data/supplementary_data.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js b/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js index 15ba8beb3c..996b5f8227 100644 --- a/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js +++ b/tests/functional/spec/features/supplementary_data/supplementary_data.spec.js @@ -372,9 +372,9 @@ describe("Using supplementary data", () => { await expect(browser).toHaveUrlContaining(ListCollectorProductsPage.pageName); await listItemComplete(`li[data-qa="list-item-1-label"]`, true); await listItemComplete(`li[data-qa="list-item-2-label"]`, true); - await listItemComplete(`li[data-qa="list-item-3-label"]`, true); + await listItemComplete(`li[data-qa="list-item-3-label"]`, false); await click(ListCollectorProductsPage.submit()); - await expect(await browser.toHaveUrlContaining(ProductRepeatingBlock1Page.pageName)); + await expect(browser).toHaveUrlContaining(ProductRepeatingBlock1Page.pageName); }); it("Given I complete the section and relaunch with the old data that has fewer items in the products list, When I am on the Hub, Then I see the products section and sales targets sections are now in progress", async () => { From 4decbb6ec3973fb14390635c80c65391192807c1 Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Tue, 17 Sep 2024 16:38:02 +0100 Subject: [PATCH 22/26] add intergration test --- tests/app/test_jinja_filters.py | 45 +++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/app/test_jinja_filters.py b/tests/app/test_jinja_filters.py index d8d45a160f..b184b58e76 100644 --- a/tests/app/test_jinja_filters.py +++ b/tests/app/test_jinja_filters.py @@ -23,6 +23,7 @@ get_width_for_number, map_list_collector_config, map_summary_item_config, + map_list_config, should_wrap_with_fieldset, strip_tags, ) @@ -1338,6 +1339,50 @@ def test_map_list_collector_config_render_icon_set(): assert output == expected +def test_map_list_config(): + list_values = [ + [ + { + 'item_title': 'Harry Potter', + 'primary_person': False, + 'list_item_id': '1', + 'is_complete': True, + 'repeating_blocks': False + }, + { + 'item_title': 'Clark Kent', + 'primary_person': False, + 'list_item_id': '2', + 'is_complete': False, + 'repeating_blocks': False + } + ] + ] + + output = map_list_config(list_values) + + expected = [ + [ + { + 'text': 'Harry Potter', + 'iconType': 'check', + 'attributes': { + 'data-qa': 'list-item-1-label', + 'data-list-item-id': '1' + } + }, + { + 'text': 'Clark Kent', + 'attributes': { + 'data-qa': 'list-item-2-label', + 'data-list-item-id': '2' + } + } + ] + ] + + assert output == expected + def to_dict(obj): return json.loads(json.dumps(obj, default=lambda o: o.__dict__)) From 0fe6760d145f4767883d2e6f5f11b6ddde9de9fd Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Tue, 17 Sep 2024 21:52:49 +0100 Subject: [PATCH 23/26] run format --- tests/app/test_jinja_filters.py | 49 +++++++++++++++++---------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/tests/app/test_jinja_filters.py b/tests/app/test_jinja_filters.py index b184b58e76..e0fd4877fc 100644 --- a/tests/app/test_jinja_filters.py +++ b/tests/app/test_jinja_filters.py @@ -22,8 +22,8 @@ get_formatted_address, get_width_for_number, map_list_collector_config, - map_summary_item_config, map_list_config, + map_summary_item_config, should_wrap_with_fieldset, strip_tags, ) @@ -1339,23 +1339,24 @@ def test_map_list_collector_config_render_icon_set(): assert output == expected + def test_map_list_config(): list_values = [ [ { - 'item_title': 'Harry Potter', - 'primary_person': False, - 'list_item_id': '1', - 'is_complete': True, - 'repeating_blocks': False + "item_title": "Harry Potter", + "primary_person": False, + "list_item_id": "1", + "is_complete": True, + "repeating_blocks": False, }, { - 'item_title': 'Clark Kent', - 'primary_person': False, - 'list_item_id': '2', - 'is_complete': False, - 'repeating_blocks': False - } + "item_title": "Clark Kent", + "primary_person": False, + "list_item_id": "2", + "is_complete": False, + "repeating_blocks": False, + }, ] ] @@ -1364,20 +1365,20 @@ def test_map_list_config(): expected = [ [ { - 'text': 'Harry Potter', - 'iconType': 'check', - 'attributes': { - 'data-qa': 'list-item-1-label', - 'data-list-item-id': '1' - } + "text": "Harry Potter", + "iconType": "check", + "attributes": { + "data-qa": "list-item-1-label", + "data-list-item-id": "1", + }, }, { - 'text': 'Clark Kent', - 'attributes': { - 'data-qa': 'list-item-2-label', - 'data-list-item-id': '2' - } - } + "text": "Clark Kent", + "attributes": { + "data-qa": "list-item-2-label", + "data-list-item-id": "2", + }, + }, ] ] From b7cd8b70b25dfaa95c707e762cd5efe249cd9206 Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Wed, 18 Sep 2024 08:41:23 +0100 Subject: [PATCH 24/26] fix test type --- tests/app/test_jinja_filters.py | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/tests/app/test_jinja_filters.py b/tests/app/test_jinja_filters.py index e0fd4877fc..9ba1bd697a 100644 --- a/tests/app/test_jinja_filters.py +++ b/tests/app/test_jinja_filters.py @@ -1342,22 +1342,20 @@ def test_map_list_collector_config_render_icon_set(): def test_map_list_config(): list_values = [ - [ - { - "item_title": "Harry Potter", - "primary_person": False, - "list_item_id": "1", - "is_complete": True, - "repeating_blocks": False, - }, - { - "item_title": "Clark Kent", - "primary_person": False, - "list_item_id": "2", - "is_complete": False, - "repeating_blocks": False, - }, - ] + { + "item_title": "Harry Potter", + "primary_person": False, + "list_item_id": "1", + "is_complete": True, + "repeating_blocks": False, + }, + { + "item_title": "Clark Kent", + "primary_person": False, + "list_item_id": "2", + "is_complete": False, + "repeating_blocks": False, + }, ] output = map_list_config(list_values) From 294ab123466652a47218754b5008f569b0bc8000 Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Wed, 18 Sep 2024 08:44:22 +0100 Subject: [PATCH 25/26] remove data-list-item-id --- app/jinja_filters.py | 1 - tests/app/test_jinja_filters.py | 2 -- 2 files changed, 3 deletions(-) diff --git a/app/jinja_filters.py b/app/jinja_filters.py index 6780478b7f..c3dfd776e3 100644 --- a/app/jinja_filters.py +++ b/app/jinja_filters.py @@ -665,7 +665,6 @@ def map_list_config(list_values: list[dict]) -> list[dict]: item["attributes"] = { "data-qa": f"list-item-{index}-label", - "data-list-item-id": value["list_item_id"], } items_list.append(item) diff --git a/tests/app/test_jinja_filters.py b/tests/app/test_jinja_filters.py index 9ba1bd697a..030240378f 100644 --- a/tests/app/test_jinja_filters.py +++ b/tests/app/test_jinja_filters.py @@ -1367,14 +1367,12 @@ def test_map_list_config(): "iconType": "check", "attributes": { "data-qa": "list-item-1-label", - "data-list-item-id": "1", }, }, { "text": "Clark Kent", "attributes": { "data-qa": "list-item-2-label", - "data-list-item-id": "2", }, }, ] From 176d590804cef4c7a0b175388ace50a75f775034 Mon Sep 17 00:00:00 2001 From: Richard McCarthy Date: Wed, 18 Sep 2024 09:06:28 +0100 Subject: [PATCH 26/26] fix test --- tests/app/test_jinja_filters.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/tests/app/test_jinja_filters.py b/tests/app/test_jinja_filters.py index 030240378f..c2c2b86d29 100644 --- a/tests/app/test_jinja_filters.py +++ b/tests/app/test_jinja_filters.py @@ -1361,21 +1361,19 @@ def test_map_list_config(): output = map_list_config(list_values) expected = [ - [ - { - "text": "Harry Potter", - "iconType": "check", - "attributes": { - "data-qa": "list-item-1-label", - }, + { + "text": "Harry Potter", + "iconType": "check", + "attributes": { + "data-qa": "list-item-1-label", }, - { - "text": "Clark Kent", - "attributes": { - "data-qa": "list-item-2-label", - }, + }, + { + "text": "Clark Kent", + "attributes": { + "data-qa": "list-item-2-label", }, - ] + }, ] assert output == expected