diff --git a/src/common-components/site-header/menu-modal/menu-modal.spec.js b/src/common-components/site-header/menu-modal/menu-modal.spec.js new file mode 100644 index 00000000..49aa5d3c --- /dev/null +++ b/src/common-components/site-header/menu-modal/menu-modal.spec.js @@ -0,0 +1,51 @@ +import { shallowMount } from "@vue/test-utils"; +import menuModal from "./menu-modal"; + +describe("menu-modal.vue", () => { + it("Should return text Footer Navigation", async () => { + // Act + const wrapper = shallowMount(menuModal); + + // Assert + const footerModalLabel = wrapper.find("h5"); + + // Expect + expect(footerModalLabel.text()).toContain("Footer Navigation"); + }); + + it("Should return footer text as Safelite Group", async () => { + // Act + const wrapper = shallowMount(menuModal); + + // Assert + const modalFooter = wrapper.find("div.modal-footer"); + + // Expect + expect(modalFooter.text()).toContain("Safelite Group"); + }); + + it("Should return Terms of use text link text", async () => { + // Act + const wrapper = shallowMount(menuModal); + + // Expect + expect(wrapper.html()).toContain("Terms of use"); + }); + + it("Should return Privacy policy text link text", async () => { + // Act + const wrapper = shallowMount(menuModal); + + // Expect + expect(wrapper.html()).toContain("Privacy policy"); + }); + + it("Should returnDo not sell my information text link text", async () => { + // Act + const wrapper = shallowMount(menuModal); + + // Expect + expect(wrapper.html()).toContain("Do not sell my information"); + }); + +}); diff --git a/src/common-components/site-header/menu-modal/menu-modal.vue b/src/common-components/site-header/menu-modal/menu-modal.vue new file mode 100644 index 00000000..37e80850 --- /dev/null +++ b/src/common-components/site-header/menu-modal/menu-modal.vue @@ -0,0 +1,125 @@ + + + + + + \ No newline at end of file diff --git a/src/common-components/site-header/site-header.vue b/src/common-components/site-header/site-header.vue index 6518f870..76de47be 100644 --- a/src/common-components/site-header/site-header.vue +++ b/src/common-components/site-header/site-header.vue @@ -1,10 +1,12 @@ \ No newline at end of file diff --git a/src/layouts/vehicle-make/vehicle-make.spec.js b/src/layouts/vehicle-make/vehicle-make.spec.js index 0e13d56f..48d995a6 100644 --- a/src/layouts/vehicle-make/vehicle-make.spec.js +++ b/src/layouts/vehicle-make/vehicle-make.spec.js @@ -39,11 +39,17 @@ describe("vehicle-make.vue", () => { ); //Assert - apiPromise.finally(() => { - expect(makeQuestion.methods.initializeComponent).toHaveBeenCalledWith( - makeQuestionInitialData - ); + return apiPromise.finally(() => { + try { + expect(makeQuestion.methods.initializeComponent).toHaveBeenCalledWith( + makeQuestionInitialData + ); + } + catch (e) { + throw e + } }); + }); test("BackButtonAction triggers a router.navigate change", async () => { @@ -68,9 +74,15 @@ describe("vehicle-make.vue", () => { await nextTick(); //Assert - apiPromise.finally(() => { - expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); - }); + return apiPromise.finally(() => { + try { + expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + } + catch (e) { + throw e + } + }); + }); test("Year set, arePagePrerequisitesValid should be true ", async () => { diff --git a/src/layouts/vehicle-model/vehicle-model.spec.js b/src/layouts/vehicle-model/vehicle-model.spec.js index 21ddd5fa..7360f795 100644 --- a/src/layouts/vehicle-model/vehicle-model.spec.js +++ b/src/layouts/vehicle-model/vehicle-model.spec.js @@ -36,17 +36,23 @@ describe("vehicle-model.vue", () => { undefined, (c) => c(wrapper.vm) ); + //Assert - apiPromise.finally(() => { - expect(modelQuestion.methods.initializeComponent).toHaveBeenCalledWith( - modelQuestionInitialData - ); + return apiPromise.finally(() => { + try { + expect(modelQuestion.methods.initializeComponent).toHaveBeenCalledWith( + modelQuestionInitialData + ); + } + catch (e) { + throw e + } }); }); }); describe("vehicle-model.vue", () => { - test("BackButtonAction triggers a router.navigateWithoutSaving change", async () => { + test("BackButtonAction triggers a router.navigate change", async () => { //Arrange const { wrapper, apiPromise } = setupMocks({ pageHeaderWidgetHeaderText: "Select a model to get started", @@ -65,12 +71,20 @@ describe("vehicle-model.vue", () => { ); wrapper.vm.backButtonAction(); await nextTick(); + //Assert - apiPromise.finally(() => { - expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); - }); + return apiPromise.finally(() => { + try { + expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + } + catch (e) { + throw e + } + }); + }); }); + describe("vehicle-model.vue", () => { test("Make set, arePagePrerequisitesValid should be true ", async () => { //Arrange diff --git a/src/layouts/vehicle-style/vehicle-style.spec.js b/src/layouts/vehicle-style/vehicle-style.spec.js index dca24943..3b055afd 100644 --- a/src/layouts/vehicle-style/vehicle-style.spec.js +++ b/src/layouts/vehicle-style/vehicle-style.spec.js @@ -43,10 +43,15 @@ describe("vehicle-style.vue", () => { ); //Assert - apiPromise.finally(() => { - expect(styleQuestion.methods.initializeComponent).toHaveBeenCalledWith( - styleQuestionInitialData - ); + return apiPromise.finally(() => { + try { + expect(styleQuestion.methods.initializeComponent).toHaveBeenCalledWith( + styleQuestionInitialData + ); + } + catch (e) { + throw e + } }); }); @@ -72,8 +77,13 @@ describe("vehicle-style.vue", () => { await nextTick(); //Assert - apiPromise.finally(() => { - expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + return apiPromise.finally(() => { + try { + expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + } + catch (e) { + throw e + } }); }); diff --git a/src/layouts/vehicle-year/vehicle-year.spec.js b/src/layouts/vehicle-year/vehicle-year.spec.js index 0d05479d..5db8c4ed 100644 --- a/src/layouts/vehicle-year/vehicle-year.spec.js +++ b/src/layouts/vehicle-year/vehicle-year.spec.js @@ -36,11 +36,17 @@ describe("vehicle-year.vue", () => { ); //Assert - apiPromise.finally(() => { - expect(yearQuestion.methods.initializeComponent).toHaveBeenCalledWith( - yearQuestionInitialData - ); + return apiPromise.finally(() => { + try { + expect(yearQuestion.methods.initializeComponent).toHaveBeenCalledWith( + yearQuestionInitialData + ); + } + catch (e) { + throw e + } }); + }); }); diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index b1804577..f8c3b0e2 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -20,6 +20,10 @@ export default { getCmsContent(widgetName, fieldName) { return this.$root.cmsContentByWidget?.[widgetName]?.[fieldName] ? this.$root.cmsContentByWidget[widgetName][fieldName] : ''; }, + getFooterInfoBoxHeight() { + const footerInfoBox = document.querySelector(".footer#infoBox"); + return footerInfoBox ? footerInfoBox.offsetHeight : 0; + }, dispatchStoreAction(type, payload, encodePayload = true) { const store = useMainStore(); diff --git a/src/ux-components/text-link/text-link.spec.js b/src/ux-components/text-link/text-link.spec.js new file mode 100644 index 00000000..ab1c21b5 --- /dev/null +++ b/src/ux-components/text-link/text-link.spec.js @@ -0,0 +1,49 @@ +import { shallowMount } from "@vue/test-utils"; +import textLink from "./text-link"; + +describe("text-link.vue", () => { + it("Should return class navigation-link", async () => { + // Act + const wrapper = shallowMount(textLink, { + propsData: { + linkType: "navigation", + }, + }); + + // Assert + const paragraph = wrapper.find("a"); + + // Expect + expect(paragraph.attributes("class")).toContain("navigation-link"); + }); + + it("Should return class footer", async () => { + // Act + const wrapper = shallowMount(textLink, { + propsData: { + linkType: "footer", + }, + }); + + // Assert + const paragraph = wrapper.find("a"); + + // Expect + expect(paragraph.attributes("class")).toContain("footer"); + }); + + it("Should return class text-small", async () => { + // Act + const wrapper = shallowMount(textLink, { + propsData: { + linkType: "textSmall", + }, + }); + + // Assert + const paragraph = wrapper.find("a"); + + // Expect + expect(paragraph.attributes("class")).toContain("small"); + }); +}); diff --git a/src/ux-components/text-link/text-link.vue b/src/ux-components/text-link/text-link.vue new file mode 100644 index 00000000..cd29bcd7 --- /dev/null +++ b/src/ux-components/text-link/text-link.vue @@ -0,0 +1,66 @@ + + + + + + \ No newline at end of file