From 97403cbb8b28e519d8f88db20b4ae2cfa51f51dd Mon Sep 17 00:00:00 2001 From: CarlNation Date: Tue, 1 Mar 2022 11:35:51 -0500 Subject: [PATCH 1/8] CSR-297 empty object valid --- src/global-methods.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/global-methods.js b/src/global-methods.js index a0023ef4c..bb202de13 100644 --- a/src/global-methods.js +++ b/src/global-methods.js @@ -19,7 +19,7 @@ export default { }).then( (response) => { if (response.status == httpStatusCodes.OK) { - if(response.data == undefined || response.data == {}) { + if(response.data == undefined) { reject(response); }else{ resolve(response); From 2fe651c47405d695a0e1748f0acc88aa5550479c Mon Sep 17 00:00:00 2001 From: CarlNation Date: Tue, 1 Mar 2022 11:52:17 -0500 Subject: [PATCH 2/8] CSR-297 change to const --- src/global-methods.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/global-methods.js b/src/global-methods.js index bb202de13..788d4c2e4 100644 --- a/src/global-methods.js +++ b/src/global-methods.js @@ -5,7 +5,7 @@ import httpStatusCodes from "http-status-codes"; export default { callHttpClient({ method, endpoint, payload }) { return new Promise((resolve, reject) => { - var apiGatewayUrl = applicationConfig.CONSUMER_APIGATEWAY_URL; + const apiGatewayUrl = applicationConfig.CONSUMER_APIGATEWAY_URL; const payloadAndAnalyticsData = Object.assign({}, payload, { AppName: "FixMyGlass", }); From 6d0dcb04a08fafde17b5d6ee1b055c6d43f2d2e2 Mon Sep 17 00:00:00 2001 From: FrankRua Date: Tue, 1 Mar 2022 13:40:12 -0500 Subject: [PATCH 3/8] PR review --- .../damage-location-question/damage-location-question.spec.js | 2 -- src/layouts/vehicle-parts/vehicle-parts.spec.js | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/layouts/vehicle-damage/damage-location-question/damage-location-question.spec.js b/src/layouts/vehicle-damage/damage-location-question/damage-location-question.spec.js index ce12c15ff..20c016a12 100644 --- a/src/layouts/vehicle-damage/damage-location-question/damage-location-question.spec.js +++ b/src/layouts/vehicle-damage/damage-location-question/damage-location-question.spec.js @@ -18,9 +18,7 @@ describe("damage-location-question.vue", () => { //Assert expect(wrapper.emitted()["update:modelValue"][0]).toEqual([{ modelValue: ["Backseat"] }]); }); -}); -describe("damage-location-question.vue", () => { test("Answers to display filtered by data from api.", async () => { //Arrange diff --git a/src/layouts/vehicle-parts/vehicle-parts.spec.js b/src/layouts/vehicle-parts/vehicle-parts.spec.js index b52be441b..5d22a458c 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.spec.js +++ b/src/layouts/vehicle-parts/vehicle-parts.spec.js @@ -66,7 +66,7 @@ const basePartResponse = { } -describe("vehicle-damage.vue", () => { +describe("vehicle-parts.vue", () => { test("Page header is initialized with api data", async (done) => { //Arrange From b734e481c1df8906c29b039e30813e00a8e5ff2b Mon Sep 17 00:00:00 2001 From: FrankRua Date: Tue, 1 Mar 2022 15:08:00 -0500 Subject: [PATCH 4/8] Fix defect for routing --- src/router/index.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 0d98f6698..aafc5e130 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -57,17 +57,20 @@ const routes = [ try { // If we already have our route, go to it. if (router.hasRoute(to.query.fmgPage)) { + // Since our route is already in scope, we can grab the component from it and call the arePagePrerequisitesValid function. - const component = router - .getRoutes() - .filter((x) => x.name === to.query.fmgPage)[0].components; + let component = router.getRoutes().filter((x) => x.name === to.query.fmgPage)[0].components; + + // If the component hasn't been loaded fully, load it before we check prerequisites. + if (component.default.methods == undefined) { + component = await component.default(); + } if (!arePagePrerequisitesValid(component)) { await GoToFunnelStartOn404(next); } - - return next({ name: to.query.fmgPage, query: to.query, params: to.params }); + return next({ name: to.query.fmgPage, query: to.query, params: to.params }); } // Get route info for the given url. Names will have a 1:1 relationship with names in the Cms. @@ -82,10 +85,7 @@ const routes = [ // Call the next components arePagePrerequisitesValid method before load. // If it returns false, use the 404 logic. - const nextComponent = await router - .getRoutes() - .filter((x) => x.name === routeData[0].name)[0] - .components.default(); + const nextComponent = await router.getRoutes().filter((x) => x.name === routeData[0].name)[0].components.default(); if (!arePagePrerequisitesValid(nextComponent)) { await GoToFunnelStartOn404(next); From 6596239d38ebf97bd2cddbbe84e9070de9884a17 Mon Sep 17 00:00:00 2001 From: FrankRua Date: Tue, 1 Mar 2022 15:09:18 -0500 Subject: [PATCH 5/8] one more = --- src/router/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/router/index.js b/src/router/index.js index aafc5e130..be434e9d8 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -62,7 +62,7 @@ const routes = [ let component = router.getRoutes().filter((x) => x.name === to.query.fmgPage)[0].components; // If the component hasn't been loaded fully, load it before we check prerequisites. - if (component.default.methods == undefined) { + if (component.default.methods === undefined) { component = await component.default(); } From 352c3c69b9a44486dc3ab5fa7375e59bbd932f5c Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 2 Mar 2022 13:12:14 -0500 Subject: [PATCH 6/8] Radio button fix and radio button unit tests added --- src/ux-components/radio/radio.spec.js | 38 +++++++++++++++++++++++++++ src/ux-components/radio/radio.vue | 32 +++++++++++----------- 2 files changed, 55 insertions(+), 15 deletions(-) diff --git a/src/ux-components/radio/radio.spec.js b/src/ux-components/radio/radio.spec.js index a7c3318ed..113d534c6 100644 --- a/src/ux-components/radio/radio.spec.js +++ b/src/ux-components/radio/radio.spec.js @@ -60,4 +60,42 @@ describe("radio.vue", () => { expect(paragraph.text()).toEqual("screenreader text"); }); + + it("Should emit button value on click", async () => { + // Act + const wrapper = shallowMount(radio, { + propsData: { + buttonLabel: "Windshield", + value: "List Card Checkbox", + buttonID: "List Card Checkbox", + groupID: "radio-demo-1", + groupName: "radio 1", + isRequired: true, + isWide: false, + modelValue: ["List Card Checkbox"], + }, + }); + wrapper.vm.handleCheckChange(); + // Assert + expect(wrapper.emitted()["isCheckedChanged"][0]).toEqual([{"buttonID": "List Card Checkbox", value: "List Card Checkbox", checkValue: Boolean}]); + }); + + it("Should set checkValue data if selectedButtonIDs has value(s)", async () => { + // Act + const wrapper = shallowMount(radio, { + propsData: { + buttonLabel: "Windshield", + buttonID: "List Card Checkbox", + groupID: "radio-demo-1", + groupName: "radio 1", + buttonImage: "windshield-damage.svg", + isRequired: true, + modelValue: ["List Card Checkbox"], + value: "Car-Front", + selectedValues: ["Car-Front"] + }, + }); + // Assert + expect(wrapper.componentVM.checkValue).toEqual(true); + }); }); diff --git a/src/ux-components/radio/radio.vue b/src/ux-components/radio/radio.vue index 99629a39b..17fb7a880 100644 --- a/src/ux-components/radio/radio.vue +++ b/src/ux-components/radio/radio.vue @@ -10,7 +10,8 @@ :aria-required="isRequired" :value="value" :v-model="checkValue" - @change="handleCheckChanged()" + @change="handleCheckChange()" + :checked="checkValue" />