From daab9909421da0c698467be8376115611930a877 Mon Sep 17 00:00:00 2001 From: Katie Date: Wed, 16 Nov 2022 15:08:26 -0500 Subject: [PATCH 1/2] CSR-748 Update navigation-scenarios --- .../questions-page-layout.vue | 10 ++- .../address-lookup/address-lookup.spec.js | 4 +- src/layouts/address-lookup/address-lookup.vue | 4 +- .../capability-questions.vue | 2 +- src/layouts/estimate/estimate.vue | 2 +- .../molding-questions/molding-questions.vue | 2 +- src/layouts/part-questions/part-questions.vue | 2 +- src/layouts/quote/quote.vue | 2 +- .../vehicle-parts/vehicle-parts.spec.js | 2 +- src/layouts/vehicle-parts/vehicle-parts.vue | 2 +- src/layouts/vin-lookup/vin-lookup.spec.js | 2 +- src/layouts/vin-lookup/vin-lookup.vue | 2 +- src/mixins/vehicle-questions-mixin.js | 13 ++-- src/mixins/vehicle-questions-mixin.spec.js | 22 +++--- .../router-constants/navigation-scenarios.js | 30 ++++---- src/router/router-constants/routing-table.js | 68 +++++++++---------- 16 files changed, 91 insertions(+), 78 deletions(-) diff --git a/src/common-components/questions-page-layout/questions-page-layout.vue b/src/common-components/questions-page-layout/questions-page-layout.vue index f544fef53..b8411c755 100644 --- a/src/common-components/questions-page-layout/questions-page-layout.vue +++ b/src/common-components/questions-page-layout/questions-page-layout.vue @@ -1,5 +1,6 @@ diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index 50e9bd3fe..292a4bb0b 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -196,7 +196,7 @@ export default { this.displayNonServiceableZipAlert = false; return this.$router.navigateWithSaving( - this.navigationScenarios.HAS_NO_QUESTIONS, + this.navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS , this.$route ); } diff --git a/src/layouts/molding-questions/molding-questions.vue b/src/layouts/molding-questions/molding-questions.vue index d7d0b0371..1efd0a795 100644 --- a/src/layouts/molding-questions/molding-questions.vue +++ b/src/layouts/molding-questions/molding-questions.vue @@ -9,7 +9,7 @@ :validationRules="questions - required" v-model="selectedAnswers" @forwardButtonAction="forwardButtonAction" - @backButtonAction="backButtonAction" + @back-click="navigateBack" :index="currentGlassIndex" /> diff --git a/src/layouts/part-questions/part-questions.vue b/src/layouts/part-questions/part-questions.vue index f370dde93..068a38b9f 100644 --- a/src/layouts/part-questions/part-questions.vue +++ b/src/layouts/part-questions/part-questions.vue @@ -9,7 +9,7 @@ :validationRules="questions - required" v-model="selectedAnswers" @forwardButtonAction="forwardButtonAction" - @backButtonAction="backButtonAction" + @back-click="navigateBack" :index="currentGlassIndex" /> diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 43f24ae82..768826c27 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -157,7 +157,7 @@ export default { } }, backButtonAction() { - vehicleQuestionsMixin.methods.backButtonAction(this); + vehicleQuestionsMixin.methods.navigateBack(this); }, }, components: { diff --git a/src/layouts/vehicle-parts/vehicle-parts.spec.js b/src/layouts/vehicle-parts/vehicle-parts.spec.js index 064b0091c..74028e69f 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.spec.js +++ b/src/layouts/vehicle-parts/vehicle-parts.spec.js @@ -497,7 +497,7 @@ describe("vehicle-parts.vue", () => { // TODO KO UNCOMMENT FOR QUOTE PAGES RELEASE // expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith( - // navigationScenarios.HAS_NO_MORE_QUESTIONS, + // navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, // { query: { fmgPage: "vehicle-parts" } } // ); }); diff --git a/src/layouts/vehicle-parts/vehicle-parts.vue b/src/layouts/vehicle-parts/vehicle-parts.vue index 18a076b70..c3f06b645 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.vue +++ b/src/layouts/vehicle-parts/vehicle-parts.vue @@ -35,7 +35,7 @@ ref="funnelFooter" :isForwardActionDisabled="isForwardActionDisabled" @tempButtonClicked="() => handleTempButtonClicked(this)" - @back-clicked="backButtonAction" + @back-click="navigateBack" @ForwardClicked="forwardButtonAction" /> diff --git a/src/layouts/vin-lookup/vin-lookup.spec.js b/src/layouts/vin-lookup/vin-lookup.spec.js index ba1343d7c..aca1b99c2 100644 --- a/src/layouts/vin-lookup/vin-lookup.spec.js +++ b/src/layouts/vin-lookup/vin-lookup.spec.js @@ -168,7 +168,7 @@ describe("vin-lookup.vue", () => { //Assert expect(wrapper.vm.$router.navigateWithSaving).toBeCalledTimes(1); expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith( - navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, + navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS, wrapper.vm.$route, expect.anything(), expect.anything() diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 3a52453b2..1548a74dc 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -368,7 +368,7 @@ export default { async navigateForward() { if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) { this.$router.navigateWithSaving( - this.navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, + this.navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS, this.$route, {}, { [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true } diff --git a/src/mixins/vehicle-questions-mixin.js b/src/mixins/vehicle-questions-mixin.js index 0a3ce43f9..d90f5c0b6 100644 --- a/src/mixins/vehicle-questions-mixin.js +++ b/src/mixins/vehicle-questions-mixin.js @@ -378,7 +378,7 @@ export default { this.currentPageComesBeforePage(currentPage, fmgPageValues.PART_QUESTIONS) ) { self.$router.navigateWithSaving( - self.navigationScenarios.HAS_PART_QUESTIONS, + self.navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS, self.$route, {}, {}, @@ -391,7 +391,7 @@ export default { // if multiple parts on any glass // go to vehicle-parts page and pass the partsData self.$router.navigateWithSaving( - self.navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE, + self.navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE, self.$route, {}, {}, @@ -404,7 +404,7 @@ export default { // if any childpart questions // go to molding-questions page and pass the partsData self.$router.navigateWithSaving( - self.navigationScenarios.HAS_MOLDING_QUESTIONS, + self.navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS, self.$route, {}, {}, @@ -444,7 +444,7 @@ export default { } self.$router.navigateWithSaving( - self.navigationScenarios.HAS_CAPABILITY_QUESTIONS, + self.navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS, self.$route, {}, {}, @@ -460,13 +460,14 @@ export default { shouldGoToHeritageQuote ? navigateToHeritageFunnel() : self.$router.navigateWithSaving( - self.navigationScenarios.HAS_NO_MORE_QUESTIONS, + self.navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, self.$route ); } }, // Can't use `this` because navigateForward is also called from quote - backButtonAction(vm) { + navigateBack(vm) { + console.log("HIIII") const self = vm ?? this; const partsOrQuestions = ( self.$store.getters.pageData(fmgPageValues.PART_QUESTIONS) ?? diff --git a/src/mixins/vehicle-questions-mixin.spec.js b/src/mixins/vehicle-questions-mixin.spec.js index a156a0c66..5ab49bc1f 100644 --- a/src/mixins/vehicle-questions-mixin.spec.js +++ b/src/mixins/vehicle-questions-mixin.spec.js @@ -1261,7 +1261,7 @@ describe("vehicle-questions-mixin", () => { // Assert expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith( - navigationScenarios.HAS_PART_QUESTIONS, + navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS, wrapper.vm.$route, {}, {}, @@ -1376,7 +1376,7 @@ describe("vehicle-questions-mixin", () => { // Assert expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith( - navigationScenarios.HAS_PART_QUESTIONS, + navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS, wrapper.vm.$route, {}, {}, @@ -1483,7 +1483,7 @@ describe("vehicle-questions-mixin", () => { // Assert expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith( - navigationScenarios.HAS_PART_QUESTIONS, + navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS, wrapper.vm.$route, {}, {}, @@ -1638,7 +1638,7 @@ describe("vehicle-questions-mixin", () => { // Assert expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith( - navigationScenarios.HAS_PART_QUESTIONS, + navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS, wrapper.vm.$route, {}, {}, @@ -1686,7 +1686,7 @@ describe("vehicle-questions-mixin", () => { // Assert expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith( - navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE, + navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE, wrapper.vm.$route, {}, {}, @@ -1798,7 +1798,7 @@ describe("vehicle-questions-mixin", () => { // Assert expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith( - navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE, + navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE, wrapper.vm.$route, {}, {}, @@ -1976,7 +1976,7 @@ describe("vehicle-questions-mixin", () => { // Assert expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith( - navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE, + navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE, wrapper.vm.$route, {}, {}, @@ -2035,7 +2035,7 @@ describe("vehicle-questions-mixin", () => { // Assert expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith( - navigationScenarios.HAS_MOLDING_QUESTIONS, + navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS, wrapper.vm.$route, {}, {}, @@ -2077,7 +2077,7 @@ describe("vehicle-questions-mixin", () => { // Assert expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith( - navigationScenarios.HAS_CAPABILITY_QUESTIONS, + navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS, wrapper.vm.$route, {}, {}, @@ -2124,7 +2124,7 @@ describe("vehicle-questions-mixin", () => { // Assert expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith( - navigationScenarios.HAS_NO_MORE_QUESTIONS, + navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, { query: { fmgPage: "vin-lookup" } } ); expect(wrapper.vm.$router.navigateWithoutSaving).not.toHaveBeenCalled(); @@ -2235,7 +2235,7 @@ describe("vehicle-questions-mixin", () => { ); expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith( - navigationScenarios.HAS_NO_MORE_QUESTIONS, + navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, { query: { fmgPage: "vin-lookup" } } ); expect(wrapper.vm.$router.navigateWithoutSaving).not.toHaveBeenCalled(); diff --git a/src/router/router-constants/navigation-scenarios.js b/src/router/router-constants/navigation-scenarios.js index bf7a6a052..6a1adf5da 100644 --- a/src/router/router-constants/navigation-scenarios.js +++ b/src/router/router-constants/navigation-scenarios.js @@ -1,3 +1,11 @@ +/** + * We want to name these to describe the scenario rather than what page(s) they're used on. + * + * Naming convention: [PAST_TENSE_VERB]_[DESCRIPTOR_OF_STATE] + * ex: Rather than "HAS_PART_QUESTIONS", we might name the + * scenario "CLICKED_FORWARD_WITH_PART_QUESTIONS" + */ + const navigationScenarios = { // General CLICKED_BACK: "CLICKED_BACK", @@ -9,29 +17,27 @@ const navigationScenarios = { SELECTED_MAKE: "SELECTED_MAKE", SELECTED_STYLE: "SELECTED_STYLE", - // Vin pages + // Vin selection CLICKED_BACK_WITH_VIN: "CLICKED_BACK_WITH_VIN", CLICKED_FORWARD_WITH_VIN: "CLICKED_FORWARD_WITH_VIN", CLICKED_FORWARD_WITHOUT_VIN: "CLICKED_FORWARD_WITHOUT_VIN", - CONTINUING_WITH_MULTIPLE_VEHICLES: "CONTINUING_WITH_MULTIPLE_VEHICLES", - SELECTED_VIN_HAS_MISMATCHED_GLASS: "SELECTED_VIN_HAS_MISMATCHED_GLASS", + CLICKED_FORWARD_WITH_MULTIPLE_VEHICLES: "CLICKED_FORWARD_WITH_MULTIPLE_VEHICLES", + SELECTED_VIN_WITH_MISMATCHED_GLASS: "SELECTED_VIN_WITH_MISMATCHED_GLASS", SELECTED_MANUAL_VIN: "SELECTED_MANUAL_VIN", SELECTED_LICENSE_PLATE: "SELECTED_LICENSE_PLATE", SELECTED_HOME_ADDRESS: "SELECTED_HOME_ADDRESS", - HAS_NO_QUESTIONS: "HAS_NO_QUESTIONS", + CLICKED_FORWARD_WITH_NO_QUESTIONS: "CLICKED_FORWARD_WITH_NO_QUESTIONS", - // Question pages - HAS_PART_QUESTIONS: "HAS_PART_QUESTIONS", - HAS_MULTIPLE_PARTS_TO_CHOOSE: "HAS_MULTIPLE_PARTS_TO_CHOOSE", - HAS_MOLDING_QUESTIONS: "HAS_MOLDING_QUESTIONS", - HAS_CAPABILITY_QUESTIONS: "HAS_CAPABILITY_QUESTIONS", - HAS_NO_MORE_QUESTIONS: "HAS_NO_MORE_QUESTIONS", + // Part selection + CLICKED_FORWARD_WITH_PART_QUESTIONS: "CLICKED_FORWARD_WITH_PART_QUESTIONS", + CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE: "CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE", + CLICKED_FORWARD_WITH_MOLDING_QUESTIONS: "CLICKED_FORWARD_WITH_MOLDING_QUESTIONS", + CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS: "CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS", + CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS: "CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS", CLICKED_BACK_WITH_PART_QUESTIONS: "CLICKED_BACK_WITH_PART_QUESTIONS", CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE: "CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE", CLICKED_BACK_WITH_MOLDING_QUESTIONS: "CLICKED_BACK_WITH_MOLDING_QUESTIONS", CLICKED_BACK_WITH_CAPABILITY_QUESTIONS: "CLICKED_BACK_WITH_CAPABILITY_QUESTIONS", - - // Quote CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS: "CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS", CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS: "CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS", }; diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 5c76ef5e1..c991087d0 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -86,7 +86,7 @@ const routingTable = function (store) { destinationFmgPageValue: fmgPageValues.ESTIMATE, }, { - scenario: navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, + scenario: navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS, destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, }, { @@ -94,23 +94,23 @@ const routingTable = function (store) { destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, }, { - scenario: navigationScenarios.HAS_PART_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS, destinationFmgPageValue: fmgPageValues.PART_QUESTIONS, }, { - scenario: navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE, destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS, }, { - scenario: navigationScenarios.HAS_MOLDING_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS, destinationFmgPageValue: fmgPageValues.MOLDING_QUESTIONS, }, { - scenario: navigationScenarios.HAS_CAPABILITY_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS, destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS, }, { - scenario: navigationScenarios.HAS_NO_MORE_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, destinationFmgPageValue: fmgPageValues.QUOTE, }, ], @@ -127,23 +127,23 @@ const routingTable = function (store) { destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, }, { - scenario: navigationScenarios.HAS_PART_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS, destinationFmgPageValue: fmgPageValues.PART_QUESTIONS, }, { - scenario: navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE, destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS, }, { - scenario: navigationScenarios.HAS_MOLDING_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS, destinationFmgPageValue: fmgPageValues.MOLDING_QUESTIONS, }, { - scenario: navigationScenarios.HAS_CAPABILITY_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS, destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS, }, { - scenario: navigationScenarios.HAS_NO_MORE_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, destinationFmgPageValue: fmgPageValues.QUOTE, }, ], @@ -156,31 +156,31 @@ const routingTable = function (store) { destinationFmgPageValue: fmgPageValues.ESTIMATE, }, { - scenario: navigationScenarios.CONTINUING_WITH_MULTIPLE_VEHICLES, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_VEHICLES, destinationFmgPageValue: fmgPageValues.ADDRESS_VEHICLES, }, { - scenario: navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, + scenario: navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS, destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, }, { - scenario: navigationScenarios.HAS_PART_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS, destinationFmgPageValue: fmgPageValues.PART_QUESTIONS, }, { - scenario: navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE, destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS, }, { - scenario: navigationScenarios.HAS_MOLDING_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS, destinationFmgPageValue: fmgPageValues.MOLDING_QUESTIONS, }, { - scenario: navigationScenarios.HAS_CAPABILITY_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS, destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS, }, { - scenario: navigationScenarios.HAS_NO_MORE_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, destinationFmgPageValue: fmgPageValues.QUOTE, }, ], @@ -197,23 +197,23 @@ const routingTable = function (store) { destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, }, { - scenario: navigationScenarios.HAS_PART_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS, destinationFmgPageValue: fmgPageValues.PART_QUESTIONS, }, { - scenario: navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE, destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS, }, { - scenario: navigationScenarios.HAS_MOLDING_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS, destinationFmgPageValue: fmgPageValues.MOLDING_QUESTIONS, }, { - scenario: navigationScenarios.HAS_CAPABILITY_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS, destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS, }, { - scenario: navigationScenarios.HAS_NO_MORE_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, destinationFmgPageValue: fmgPageValues.QUOTE, }, ], @@ -238,7 +238,7 @@ const routingTable = function (store) { destinationFmgPageValue: fmgPageValues.ADDRESS_LOOKUP, }, { - scenario: navigationScenarios.HAS_NO_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS , destinationFmgPageValue: fmgPageValues.QUOTE, }, ], @@ -255,19 +255,19 @@ const routingTable = function (store) { destinationFmgPageValue: fmgPageValues.ESTIMATE, }, { - scenario: navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE, destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS, }, { - scenario: navigationScenarios.HAS_MOLDING_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS, destinationFmgPageValue: fmgPageValues.MOLDING_QUESTIONS, }, { - scenario: navigationScenarios.HAS_CAPABILITY_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS, destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS, }, { - scenario: navigationScenarios.HAS_NO_MORE_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, destinationFmgPageValue: fmgPageValues.QUOTE, }, ], @@ -292,15 +292,15 @@ const routingTable = function (store) { destinationFmgPageValue: fmgPageValues.ESTIMATE, }, { - scenario: navigationScenarios.HAS_MOLDING_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS, destinationFmgPageValue: fmgPageValues.MOLDING_QUESTIONS, }, { - scenario: navigationScenarios.HAS_CAPABILITY_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS, destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS, }, { - scenario: navigationScenarios.HAS_NO_MORE_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, destinationFmgPageValue: fmgPageValues.QUOTE, }, ], @@ -325,11 +325,11 @@ const routingTable = function (store) { destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS, }, { - scenario: navigationScenarios.HAS_CAPABILITY_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS, destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS, }, { - scenario: navigationScenarios.HAS_NO_MORE_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, destinationFmgPageValue: fmgPageValues.QUOTE, }, ], @@ -358,7 +358,7 @@ const routingTable = function (store) { destinationFmgPageValue: fmgPageValues.MOLDING_QUESTIONS, }, { - scenario: navigationScenarios.HAS_NO_MORE_QUESTIONS, + scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, destinationFmgPageValue: fmgPageValues.QUOTE, }, ], From 33f58fda6d20fe6224e3060360d74a7548028e98 Mon Sep 17 00:00:00 2001 From: Katie Date: Wed, 16 Nov 2022 23:53:10 -0500 Subject: [PATCH 2/2] CSR-748 Fix tests and format --- src/layouts/estimate/estimate.vue | 2 +- src/layouts/vehicle-parts/vehicle-parts.spec.js | 8 ++++---- src/mixins/vehicle-questions-mixin.js | 1 - src/mixins/vehicle-questions-mixin.spec.js | 12 ++++++------ src/router/router-constants/routing-table.js | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index 292a4bb0b..523e0b103 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -196,7 +196,7 @@ export default { this.displayNonServiceableZipAlert = false; return this.$router.navigateWithSaving( - this.navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS , + this.navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS, this.$route ); } diff --git a/src/layouts/vehicle-parts/vehicle-parts.spec.js b/src/layouts/vehicle-parts/vehicle-parts.spec.js index 74028e69f..66b8996e7 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.spec.js +++ b/src/layouts/vehicle-parts/vehicle-parts.spec.js @@ -196,7 +196,7 @@ describe("vehicle-parts.vue", () => { }); }); - test("User had part questions > BackButtonAction triggers a router.navigateWithoutSaving change with correct scenario", async () => { + test("User had part questions > navigateBack triggers a router.navigateWithoutSaving change with correct scenario", async () => { //Arrange const { wrapper } = setupMocks({ mountOptionsMockData: { @@ -248,7 +248,7 @@ describe("vehicle-parts.vue", () => { (c) => c(wrapper.vm) ); - wrapper.vm.backButtonAction(); + wrapper.vm.navigateBack(); //Assert expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith( @@ -257,7 +257,7 @@ describe("vehicle-parts.vue", () => { ); }); - test("User did not have part questions > BackButtonAction triggers a router.navigateWithoutSaving change with correct scenario", async () => { + test("User did not have part questions > navigateBack triggers a router.navigateWithoutSaving change with correct scenario", async () => { //Arrange const { wrapper } = setupMocks({ mountOptionsMockData: { @@ -294,7 +294,7 @@ describe("vehicle-parts.vue", () => { (c) => c(wrapper.vm) ); - wrapper.vm.backButtonAction(); + wrapper.vm.navigateBack(); //Assert expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith( diff --git a/src/mixins/vehicle-questions-mixin.js b/src/mixins/vehicle-questions-mixin.js index d90f5c0b6..0f8c73a88 100644 --- a/src/mixins/vehicle-questions-mixin.js +++ b/src/mixins/vehicle-questions-mixin.js @@ -467,7 +467,6 @@ export default { }, // Can't use `this` because navigateForward is also called from quote navigateBack(vm) { - console.log("HIIII") const self = vm ?? this; const partsOrQuestions = ( self.$store.getters.pageData(fmgPageValues.PART_QUESTIONS) ?? diff --git a/src/mixins/vehicle-questions-mixin.spec.js b/src/mixins/vehicle-questions-mixin.spec.js index 5ab49bc1f..4bfa9285c 100644 --- a/src/mixins/vehicle-questions-mixin.spec.js +++ b/src/mixins/vehicle-questions-mixin.spec.js @@ -2243,7 +2243,7 @@ describe("vehicle-questions-mixin", () => { }); }); - describe("backButtonAction", () => { + describe("navigateBack", () => { // TODO KO test.todo( "current page is quote, there are no questions, and we don't have their vin => go to estimate" @@ -2254,7 +2254,7 @@ describe("vehicle-questions-mixin", () => { const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE, hasVin: true }); // Act - wrapper.vm.backButtonAction(); + wrapper.vm.navigateBack(); // Assert expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith( @@ -2269,7 +2269,7 @@ describe("vehicle-questions-mixin", () => { wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true); // Act - wrapper.vm.backButtonAction(); + wrapper.vm.navigateBack(); // Assert expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith( @@ -2285,7 +2285,7 @@ describe("vehicle-questions-mixin", () => { wrapper.vm.hasChildPartQuestions = jest.fn().mockReturnValue(true); // Act - wrapper.vm.backButtonAction(); + wrapper.vm.navigateBack(); // Assert expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith( @@ -2303,7 +2303,7 @@ describe("vehicle-questions-mixin", () => { wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true); // Act - wrapper.vm.backButtonAction(); + wrapper.vm.navigateBack(); // Assert expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith( @@ -2321,7 +2321,7 @@ describe("vehicle-questions-mixin", () => { wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true); // Act - wrapper.vm.backButtonAction(); + wrapper.vm.navigateBack(); // Assert expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith( diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index c991087d0..1c060b082 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -238,7 +238,7 @@ const routingTable = function (store) { destinationFmgPageValue: fmgPageValues.ADDRESS_LOOKUP, }, { - scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS , + scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS, destinationFmgPageValue: fmgPageValues.QUOTE, }, ],