From df2755ad62ad53f67407c3838fd909bb65f5a968 Mon Sep 17 00:00:00 2001 From: Sneha Date: Thu, 20 Jun 2024 09:34:32 +0530 Subject: [PATCH] CSR-2113 --- .../content-group-modal.vue | 14 ++- src/layouts/quote/quote.spec.js | 4 + src/layouts/quote/quote.vue | 19 ++- .../recal-disclaimer/recal-disclaimer.spec.js | 51 ++++++++ .../recal-disclaimer/recal-disclaimer.vue | 115 ++++++++++++++++++ .../service-package-question.vue | 7 +- 6 files changed, 206 insertions(+), 4 deletions(-) create mode 100644 src/layouts/quote/recal-disclaimer/recal-disclaimer.spec.js create mode 100644 src/layouts/quote/recal-disclaimer/recal-disclaimer.vue diff --git a/src/fmg-components/content-group-modal/content-group-modal.vue b/src/fmg-components/content-group-modal/content-group-modal.vue index a64d10fa3..d1b53a9bb 100644 --- a/src/fmg-components/content-group-modal/content-group-modal.vue +++ b/src/fmg-components/content-group-modal/content-group-modal.vue @@ -4,8 +4,14 @@ :modalId="ModalName" :footerButtonText="ModalCloseButtonText" @footer-button-event="footerButtonClick"> - -
+
+
+ +
+
+ +
+

({ commit: jest.fn(), @@ -22,6 +23,9 @@ jest.mock("@/helpers/cms-content-helper", () => ({ jest.mock("@/helpers/heritage-integration/navigation-helper", () => ({ navigateToHeritageFunnel: jest.fn(), })); +jest.mock("@/helpers/service-package-helper", () => ({ + containsLineItemWithPartType: jest.fn(), +})); jest.mock("@/helpers/promotions-helper", () => ({ revalidatePromosAndValidateQueryStringPromo: jest.fn(() => { diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 7effa6332..c01a894ca 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -36,12 +36,19 @@ isRequired /> + + diff --git a/src/layouts/quote/recal-disclaimer/recal-disclaimer.spec.js b/src/layouts/quote/recal-disclaimer/recal-disclaimer.spec.js new file mode 100644 index 000000000..6ea280658 --- /dev/null +++ b/src/layouts/quote/recal-disclaimer/recal-disclaimer.spec.js @@ -0,0 +1,51 @@ +import { mount } from "@vue/test-utils"; +import recalDisclamer from "./recal-disclaimer"; + +describe("recal-disclaimer.vue", () => { + it("Should display header text when HeaderText is defined in the CMS", async () => { + const wrapper = mount(recalDisclamer, { + mixins: [mockMixin], + props: { + cmsWidgetName: "test", + }, + attachTo: document.body, + }); + expect(wrapper.html()).toEqual(expect.stringContaining(mockCmsContent["HeaderText"])); + }); + + it("Should insert image url when Image is defined in the CMS", async () => { + const wrapper = mount(recalDisclamer, { + mixins: [mockMixin], + props: { + cmsWidgetName: "test", + }, + attachTo: document.body, + }); + expect(wrapper.html()).toEqual(expect.stringContaining(mockCmsContent["Image"])); + }); + + it("Should display subheader text when SubheaderText is defined in the CMS", async () => { + const wrapper = mount(recalDisclamer, { + mixins: [mockMixin], + props: { + cmsWidgetName: "test", + }, + attachTo: document.body, + }); + expect(wrapper.html()).toEqual(expect.stringContaining(mockCmsContent["SubheaderText"])); + }); +}); + +const mockMixin = { + methods: { + getCmsContent: jest.fn((widgetName, cmsFieldName) => { + return mockCmsContent[cmsFieldName]; + }), + }, +}; + +const mockCmsContent = { + HeaderText: "Sample header text here.", + SubheaderText: "Sample subheader text here.", + Image: "https://www.sampleImage.sample", +}; diff --git a/src/layouts/quote/recal-disclaimer/recal-disclaimer.vue b/src/layouts/quote/recal-disclaimer/recal-disclaimer.vue new file mode 100644 index 000000000..c7f31db33 --- /dev/null +++ b/src/layouts/quote/recal-disclaimer/recal-disclaimer.vue @@ -0,0 +1,115 @@ + + + + + diff --git a/src/layouts/quote/service-package-question/service-package-question.vue b/src/layouts/quote/service-package-question/service-package-question.vue index e77cdfb19..5f72d6d16 100644 --- a/src/layouts/quote/service-package-question/service-package-question.vue +++ b/src/layouts/quote/service-package-question/service-package-question.vue @@ -234,10 +234,15 @@ export default { }, getPackagePrice(packageName, { discountedPrice = false, servicePackageDiscount = false }) { var lineItemsToPrice = [...this.nullSafeAvailableLineItems]; + if (this.isRecalibrationOnOrder) { + lineItemsToPrice = this.nullSafeAvailableLineItems.filter((item) => { + return item.partType != partTypeStrings.RECALIBRATION; + }); + } //remove service package discount part if (this.isServicePackageDiscountOnOrder) { - lineItemsToPrice = this.nullSafeAvailableLineItems.filter((item) => { + lineItemsToPrice = lineItemsToPrice.filter((item) => { return item.partType != this.servicePackageDiscountParts[0].partType; }); }