From a01cba532cbfff1762ede66814263fe72a2d4f18 Mon Sep 17 00:00:00 2001 From: Mark Harris Date: Wed, 1 Dec 2021 17:10:08 -0500 Subject: [PATCH 01/12] miscellaneous comments --- src/layouts/vehicle-year/vehicle-year.vue | 11 ++++++----- src/store/index.js | 7 +++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/layouts/vehicle-year/vehicle-year.vue b/src/layouts/vehicle-year/vehicle-year.vue index 941d1328c..8c0c24004 100644 --- a/src/layouts/vehicle-year/vehicle-year.vue +++ b/src/layouts/vehicle-year/vehicle-year.vue @@ -30,11 +30,14 @@ export default { }; }, computed: {}, + beforeRouteEnter(to, from, next) { + // Call APIs const contentPromise = fetchCmsContentForPage(to.query.fmgPage); const getVehicleYearPromise = store.dispatch(storeActions.GET_VEHICLE_YEARS, {}); + // Settle promises and get results const promiseResultMap = [ { resultKey: "getPageContent", @@ -45,19 +48,17 @@ export default { promise: getVehicleYearPromise, }, ]; - settleAllPromises(promiseResultMap).then((resultMap) => { - // Call our next function to transition to the next page. + // Call the "next" function to complete the transition to this page. next((vm) => { vm.pageHeaderWidgets = resultMap.getPageContent.PageHeaderWidget[0]; vm.radioQuestionWidgets = resultMap.getPageContent.RadioQuestionWidget[0]; vm.vehicleYears = resultMap.getVehicleYear; - }); - + }); }); - }, + components: { yearQuestion, pageHeader, diff --git a/src/store/index.js b/src/store/index.js index 0976690b7..abe72764e 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -9,6 +9,11 @@ export default createStore({ storage: window.sessionStorage, }), ], + + // IMPORTANT: Be VERY careful when modifying these fields for at least a few reasons: + // * The CMS can reference the fields by name + // * Return users may have a previous "version" of the model, and we don't want + // them to have a breaking experience, because the model might have changed. state: { order: { vehicle: { @@ -63,6 +68,8 @@ export default createStore({ experiments: null, } }, + // See IMPORTANT note at top of "state" declaration. + mutations: { updateVehicleImage(state, data) { state.order.vehicle.imageSrc = data.imgSrc; From fb027c281e92b03bcb731918ffb436d8f6e66f25 Mon Sep 17 00:00:00 2001 From: bmauger Date: Wed, 1 Dec 2021 17:34:51 -0500 Subject: [PATCH 02/12] WIP CSR-186 radio button updates. --- src/layouts/component-test/component-test.vue | 21 ++++++--- src/styles/common-radio-styles.scss | 3 ++ src/styles/common-typography-styles.scss | 4 +- .../button-primary/button-primary.vue | 2 +- .../button-secondary/button-secondary.vue | 2 +- src/ux-components/list-button/list-button.vue | 2 +- src/ux-components/radio/radio.spec.js | 2 +- src/ux-components/radio/radio.vue | 47 ++++++++----------- 8 files changed, 44 insertions(+), 39 deletions(-) diff --git a/src/layouts/component-test/component-test.vue b/src/layouts/component-test/component-test.vue index df7578bf0..f4b4047fc 100644 --- a/src/layouts/component-test/component-test.vue +++ b/src/layouts/component-test/component-test.vue @@ -81,6 +81,7 @@ groupName="demo-1" ariaLabelBy="vehicle-year" radioID="2021" + radioLabelValue="2021" textPosition="text-start" loaderColor="blue" loaderPosition="right" @@ -90,6 +91,7 @@ groupName="demo-1" ariaLabelBy="vehicle-year" radioID="2020" + radioLabelValue="2020" textPosition="text-start" loaderColor="blue" loaderPosition="right" @@ -99,6 +101,7 @@ groupName="demo-1" ariaLabelBy="vehicle-year" radioID="2019" + radioLabelValue="2019" textPosition="text-start" loaderColor="blue" loaderPosition="right" @@ -120,7 +123,8 @@ groupName="demo-2" ariaLabelBy="vehicle-make" radioID="Chevrolet" - radioSubID="Test sub-headline" + radioLabelValue="Chevrolet" + radioLabelSubCopy="Test sub-headline" textPosition="text-start" loaderColor="blue" loaderPosition="right" @@ -130,7 +134,8 @@ groupName="demo-2" ariaLabelBy="vehicle-make" radioID="Dodge" - radioSubID="Test sub-headline" + radioLabelValue="Dodge" + radioLabelSubCopy="Test sub-headline" textPosition="text-start" loaderColor="blue" loaderPosition="right" @@ -140,7 +145,8 @@ groupName="demo-2" ariaLabelBy="vehicle-make" radioID="Ford" - radioSubID="Test sub-headline" + radioLabelValue="Ford" + radioLabelSubCopy="Test sub-headline" textPosition="text-start" loaderColor="blue" loaderPosition="right" @@ -157,7 +163,8 @@ groupName="demo-3" ariaLabelBy="vehicle-model" radioID="Corvette" - radioSubID="Test sub-headline" + radioLabelValue="Corvette" + radioLabelSubCopy="Test sub-headline" textPosition="text-center" loaderColor="blue" loaderPosition="right" @@ -167,7 +174,8 @@ groupName="demo-3" ariaLabelBy="vehicle-model" radioID="Testarosa" - radioSubID="Test sub-headline" + radioLabelValue="Testarosa" + radioLabelSubCopy="Test sub-headline" textPosition="text-center" loaderColor="blue" loaderPosition="right" @@ -177,7 +185,8 @@ groupName="demo-3" ariaLabelBy="vehicle-model" radioID="S600" - radioSubID="Test sub-headline" + radioLabelValue="S600" + radioLabelSubCopy="Test sub-headline" textPosition="text-center" loaderColor="blue" loaderPosition="right" diff --git a/src/styles/common-radio-styles.scss b/src/styles/common-radio-styles.scss index 5457db992..2bee198bf 100644 --- a/src/styles/common-radio-styles.scss +++ b/src/styles/common-radio-styles.scss @@ -14,6 +14,9 @@ background: $blue-100; box-shadow: 0 0 0 1px $blue; } + &:checked + label p:first-child { + font-weight: 500; + } } label { position: relative; diff --git a/src/styles/common-typography-styles.scss b/src/styles/common-typography-styles.scss index 05af0defc..7f6163193 100644 --- a/src/styles/common-typography-styles.scss +++ b/src/styles/common-typography-styles.scss @@ -34,7 +34,7 @@ h6,.h6 { } label { - line-height: 1.625; + line-height: 1.5; font-weight: 400; } @@ -54,4 +54,4 @@ caption { font-size: 1rem !important; line-height: 1.4; font-weight: 500; -} \ No newline at end of file +} diff --git a/src/ux-components/button-primary/button-primary.vue b/src/ux-components/button-primary/button-primary.vue index c129115c4..7da10a107 100644 --- a/src/ux-components/button-primary/button-primary.vue +++ b/src/ux-components/button-primary/button-primary.vue @@ -5,7 +5,7 @@ class="btn btn-primary d-flex align-items-center py-3 px-4" @click='displayComponent' > -

{{ this.buttonText }}

+ {{ this.buttonText }} -

{{ this.buttonText }}

+ {{ this.buttonText }} -

{{ this.buttonText }}

+ {{ this.buttonText }} { // Assert const input = wrapper.find("input"); const label = wrapper.find("label"); - const paragraph = wrapper.find("p"); + const paragraph = wrapper.find("span"); await label.trigger('click'); diff --git a/src/ux-components/radio/radio.vue b/src/ux-components/radio/radio.vue index 78d6e4144..48d70821d 100644 --- a/src/ux-components/radio/radio.vue +++ b/src/ux-components/radio/radio.vue @@ -1,24 +1,17 @@ diff --git a/src/constants/widget-names.js b/src/constants/widget-names.js index bad1390c6..ed8c1a8a6 100644 --- a/src/constants/widget-names.js +++ b/src/constants/widget-names.js @@ -1,6 +1,7 @@ const widgetNames = { PAGE_HEADER_WIDGET: "PageHeaderWidget", RADIO_QUESTION_WIDGET: "RadioQuestionWidget", + VEHICLE_BANNER_WIDGET: "VehicleBannerWidget", }; export { widgetNames }; From 2471fb9b03cea8ab1b9ec8f45092ab5de407512e Mon Sep 17 00:00:00 2001 From: Mark Harris Date: Thu, 2 Dec 2021 10:34:40 -0500 Subject: [PATCH 05/12] Removing non-mvp fields from the store --- src/store/index.js | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index abe72764e..5636ab2cc 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -27,7 +27,6 @@ export default createStore({ evoxImageId: null, hasSplitWindshieldOption: null, hasBackglassSliderOption: null, - imageSrc: '', registration: { rawAddress: null, zipCode: null, @@ -40,28 +39,19 @@ export default createStore({ isReplacement: null, numberOfChips: null, glassToReplace: null, - problemGlassQuestions: null, - problemMoldingQuestions: null, - problemPropertyQuestions: null, + problemGlassQuestionAnswers: null, + problemMoldingQuestionAnswers: null, + problemPropertyQuestionAnswers: null, }, - items: null, + lineItems: null, customer: { emailAddress: null, - firstName: null, - lastName: null, - phoneNumber: { - isMobile: null, - optInSms: null, - } }, payment: { isInsurance: null, isCash: null, }, - referral: { - referralSeqNum: null, - workOrderId: null - } + referralSeqNum: null, } }, applicationUser: { @@ -71,9 +61,6 @@ export default createStore({ // See IMPORTANT note at top of "state" declaration. mutations: { - updateVehicleImage(state, data) { - state.order.vehicle.imageSrc = data.imgSrc; - }, }, actions: { // Vehicle API Actions From b248a3169a26ded6f1a92028bc8e3d5ed0824b66 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Thu, 2 Dec 2021 11:39:13 -0500 Subject: [PATCH 06/12] CSR-120: updates to move CMS logic into parent vehicle-year layout --- .../vehicle-banner/vehicle-banner.spec.js | 35 ------------------- .../vehicle-banner/vehicle-banner.vue | 21 ++--------- src/layouts/component-test/component-test.vue | 8 ++--- src/layouts/vehicle-year/vehicle-year.spec.js | 1 + src/layouts/vehicle-year/vehicle-year.vue | 4 ++- 5 files changed, 8 insertions(+), 61 deletions(-) diff --git a/src/common-components/vehicle-banner/vehicle-banner.spec.js b/src/common-components/vehicle-banner/vehicle-banner.spec.js index 470410842..2194b4140 100644 --- a/src/common-components/vehicle-banner/vehicle-banner.spec.js +++ b/src/common-components/vehicle-banner/vehicle-banner.spec.js @@ -5,11 +5,6 @@ import { storeActions } from "@/constants/store-actions"; import { nextTick } from 'vue'; import { settleAllPromises } from "@/helpers/layout-helper"; -// Mock our module for promises. -jest.mock("@/helpers/layout-helper.js", () => ({ - settleAllPromises: jest.fn() -})); - describe('vehicleBanner', () => { const $store = { state: { @@ -51,17 +46,6 @@ describe('vehicleBanner', () => { ] }; - // Our mock data for our call to settleAllPromises - const mockData = { - getPageContent: { - VehicleBannerWidget: [{ GenericVehicleImage: "testurl" }], - isCmsContentReady: true, - } - } - - // our mock implementation of settleAllPromises - settleAllPromises.mockImplementation(() => { return Promise.resolve(mockData);}); - test('renders the blurrycar image when vehicleImageSrc is not present', () => { // Arrange const mountOptions = getMountOptions(actionList); @@ -158,23 +142,4 @@ describe('vehicleBanner', () => { wrapper.unmount(); }); - test("vehicle-banner.vue should render data from CMS", async () => { - // Arrange - const mountOptions = getMountOptions(actionList); - mountOptions.global.mocks = { - ...mountOptions.global.mocks, - $store - } - // Act - const wrapper = shallowMount(vehicleBanner, { - ...mountOptions - }); - // Call method getGenericVehicleImage on the component. - await wrapper.vm.getGenericVehicleImage(); - // Wait for the DOM to update. - await nextTick(); - // Assert - expect(wrapper.vm.genericVehicleImageSrc).toEqual("testurl"); - }); - }); diff --git a/src/common-components/vehicle-banner/vehicle-banner.vue b/src/common-components/vehicle-banner/vehicle-banner.vue index c1376710b..36642288d 100644 --- a/src/common-components/vehicle-banner/vehicle-banner.vue +++ b/src/common-components/vehicle-banner/vehicle-banner.vue @@ -16,9 +16,6 @@ diff --git a/src/layouts/component-test/component-test.vue b/src/layouts/component-test/component-test.vue index c64a3fe0a..ff80496fc 100644 --- a/src/layouts/component-test/component-test.vue +++ b/src/layouts/component-test/component-test.vue @@ -314,12 +314,8 @@
- - + +
diff --git a/src/layouts/vehicle-year/vehicle-year.spec.js b/src/layouts/vehicle-year/vehicle-year.spec.js index d3fd4fe77..60d3b8353 100644 --- a/src/layouts/vehicle-year/vehicle-year.spec.js +++ b/src/layouts/vehicle-year/vehicle-year.spec.js @@ -19,6 +19,7 @@ describe("vehicle-year.vue", () => { getPageContent: { PageHeaderWidget: [{ HeaderText: "Select a year to get started" }], RadioQuestionWidget: [{ QuestionText: "What year is your vehicle?" }], + VehicleBannerWidget: [{ GenericVehicleImage: "https://digitalconsumercms-dev.safelite.com/images/default-source/default-album/blurred-image.jpg?sfvrsn=a6ce3034_3" }], isCmsContentReady: true, }, getVehicleYear: [2023, 2022, 2021] diff --git a/src/layouts/vehicle-year/vehicle-year.vue b/src/layouts/vehicle-year/vehicle-year.vue index 8c0c24004..e47c1b219 100644 --- a/src/layouts/vehicle-year/vehicle-year.vue +++ b/src/layouts/vehicle-year/vehicle-year.vue @@ -1,7 +1,7 @@