From 89d32b6a5b09ff31b3adc7e656844a37907b1328 Mon Sep 17 00:00:00 2001 From: Donielle Austin Date: Thu, 12 May 2022 16:52:40 -0400 Subject: [PATCH 1/8] ga event defect --- src/constants/analytics.js | 1 + src/layouts/address-lookup/address-lookup.vue | 14 ++++++++++++++ .../license-plate-lookup/license-plate-lookup.vue | 7 ++++--- src/layouts/vin-lookup/vin-lookup.vue | 14 +++++++++----- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/constants/analytics.js b/src/constants/analytics.js index f6f6ff82e..a3f057150 100644 --- a/src/constants/analytics.js +++ b/src/constants/analytics.js @@ -26,6 +26,7 @@ const GaLabels = { ERROR: 'Error', LICENSE_PLATE_LOOKUP: 'License_Plate_Look_Up', VIN_LOOKUP: 'Vin_Look_Up', + ADDRESS_LOOKUP: 'Address_Look_up', }; diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 54f096896..87278476a 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -152,6 +152,17 @@ export default { this.$route ); }, + attachCustomEvents() { + this.prependActionToMethod(this, this.forwardButtonAction, this.logGAEventForVin()); + }, + logGAEventForVin(){ + this.pushEventToGA( + this.$route.query[this.queryStrings.FMG_PAGE], + this.GaActions.SUBMITTED, + this.GaLabels.ADDRESS_LOOKUP, + true + ); + }, getRegistrationAddressFromStore() { return store.getters.vehicle.registration.address; }, @@ -337,6 +348,9 @@ export default { }, }, + mounted() { + this.attachCustomEvents(); + }, computed: { AlertNonServiceableZipHeader(){ const zipCode = this.serviceZipCode ? this.serviceZipCode : this.customerQuestions.addressQuestions.zipCode; diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index 5e7fdc2c1..13f50ecc4 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -187,14 +187,15 @@ export default { store.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); }, attachCustomEvents() { - this.prependActionToMethod(this, this.forwardButtonAction, () => { - this.pushEventToGA( + this.prependActionToMethod(this, this.forwardButtonAction, this.logGAEventForVin()); + }, + logGAEventForVin(){ + this.pushEventToGA( this.$route.query[this.queryStrings.FMG_PAGE], this.GaActions.SUBMITTED, this.GaLabels.LICENSE_PLATE_LOOKUP, true ); - }); }, getLicensePlateFromStore() { return store.getters.vehicle.registration.licensePlate; diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 0294716af..4dc1f6382 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -192,6 +192,9 @@ export default { vinPopulatedOnPageLoad: this.getVinFromStore()?.length > 0, }; }, + mounted() { + this.attachCustomEvents(); + }, computed: { perfectMatchNewVinAlert() { return this.vinPopulatedOnPageLoad && this.vin === this.getVinFromStore(); @@ -255,15 +258,16 @@ export default { getZipFromStore(){ return store.getters.order.serviceLocation.zipCode; }, - attachCustomEvents() { - this.prependActionToMethod(this, this.forwardButtonAction, () => { - this.pushEventToGA( + attachCustomEvents() { + this.prependActionToMethod(this, this.forwardButtonAction, this.logGAEventForVin()); + }, + logGAEventForVin(){ + this.pushEventToGA( this.$route.query[this.queryStrings.FMG_PAGE], this.GaActions.SUBMITTED, - this.GaLabels.VINLOOKUP, + this.GaLabels.VIN_LOOKUP, true ); - }); }, backButtonAction() { this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); From 4ecf7b0d5acc8cdeb464d008e7c679dc3ecfc522 Mon Sep 17 00:00:00 2001 From: Donielle Austin Date: Fri, 13 May 2022 13:40:15 -0400 Subject: [PATCH 2/8] will update tests later --- .../license-plate-lookup/license-plate-lookup.spec.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js index 9afd7e39a..33169e5e3 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js +++ b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js @@ -1,4 +1,4 @@ -// Components +/* // Components import licensePlateLookup from "@/layouts/license-plate-lookup/license-plate-lookup.vue"; // Supporting Files @@ -10,6 +10,7 @@ import { shallowMount, flushPromises } from "@vue/test-utils"; import { getMountOptions } from "@/helpers/unit-test-helper.js"; import { nextTick } from "vue"; import store from "@/store"; +import { mount } from "@vue/test-utils"; jest.mock('@/assets/img/loader.gif', () => 'loader.gif') jest.mock('@/assets/img/windshield.png', () => 'windshield.png') @@ -86,7 +87,6 @@ describe("license-plate-lookup.vue", () => { //Assert expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); - }); }); @@ -466,3 +466,4 @@ function setupMocks({ return { wrapper, apiPromise }; } + */ \ No newline at end of file From 1c4d6099591b01347fc69341caf2dce553710236 Mon Sep 17 00:00:00 2001 From: Donielle Austin Date: Fri, 13 May 2022 14:07:06 -0400 Subject: [PATCH 3/8] testing --- .../license-plate-lookup.spec.js | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js index 33169e5e3..2d613c47a 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js +++ b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js @@ -1,4 +1,4 @@ -/* // Components +// Components import licensePlateLookup from "@/layouts/license-plate-lookup/license-plate-lookup.vue"; // Supporting Files @@ -10,7 +10,6 @@ import { shallowMount, flushPromises } from "@vue/test-utils"; import { getMountOptions } from "@/helpers/unit-test-helper.js"; import { nextTick } from "vue"; import store from "@/store"; -import { mount } from "@vue/test-utils"; jest.mock('@/assets/img/loader.gif', () => 'loader.gif') jest.mock('@/assets/img/windshield.png', () => 'windshield.png') @@ -48,7 +47,7 @@ jest.mock("@/store", () => ({ }, })); -describe("license-plate-lookup.vue", () => { +describe.skip("license-plate-lookup.vue", () => { test("CarId set, arePagePrerequisitesValid should be true ", async () => { //Arrange const { wrapper } = setupMocks({}); @@ -69,7 +68,7 @@ describe("license-plate-lookup.vue", () => { }); }); -describe("license-plate-lookup.vue", () => { +describe.skip("license-plate-lookup.vue", () => { test("BackButtonAction triggers a router.navigate change", async () => { //Arrange @@ -90,7 +89,7 @@ describe("license-plate-lookup.vue", () => { }); }); -describe("license-plate-lookup.vue", () => { +describe.skip("license-plate-lookup.vue", () => { test("getLicensePlateFromStore returns store license plate", async () => { // Arrange @@ -104,7 +103,7 @@ describe("license-plate-lookup.vue", () => { }); }); -describe("license-plate-lookup.vue", () => { +describe.skip("license-plate-lookup.vue", () => { test("getRegistrationZipFromStore returns store registration zip", async () => { // Arrange @@ -118,7 +117,7 @@ describe("license-plate-lookup.vue", () => { }); }); -describe("license-plate-lookup.vue", () => { +describe.skip("license-plate-lookup.vue", () => { test("getEmailFromStore returns store customer email", async () => { // Arrange @@ -132,7 +131,7 @@ describe("license-plate-lookup.vue", () => { }); }); -describe("license-plate-lookup.vue", () => { +describe.skip("license-plate-lookup.vue", () => { test("getServiceZipFromStore returns store service zip", async () => { // Arrange @@ -146,7 +145,7 @@ describe("license-plate-lookup.vue", () => { }); }); -describe("license-plate-lookup.vue", () => { +describe.skip("license-plate-lookup.vue", () => { test("Navigate forward should be called and isCarId should be set to false when data entered matches store data on forwardButtonAction click", async () => { // Arrange @@ -180,7 +179,7 @@ describe("license-plate-lookup.vue", () => { }); }); -describe("license-plate-lookup.vue", () => { +describe.skip("license-plate-lookup.vue", () => { test("Function should stop and datam isRegistrationZipServicable should be set to false when service zip entered returns false on forwardButtonAction click", async () => { // Arrange @@ -208,7 +207,7 @@ describe("license-plate-lookup.vue", () => { }); }); -describe("license-plate-lookup.vue", () => { +describe.skip("license-plate-lookup.vue", () => { test("Function should stop and datam isCarIdDifferent should be set to true when carId entered doesn't match store carId or previously entered carId on forwardButtonAction click", async () => { // Arrange @@ -242,7 +241,7 @@ describe("license-plate-lookup.vue", () => { }); }); -describe("license-plate-lookup.vue", () => { +describe.skip("license-plate-lookup.vue", () => { test("Navigate forward should be called and isCarId should be set to true when carId entered matches previously entered carId and rest of data entered matches store data on forwardButtonAction click", async () => { // Arrange @@ -277,7 +276,7 @@ describe("license-plate-lookup.vue", () => { }); }); -describe("license-plate-lookup.vue", () => { +describe.skip("license-plate-lookup.vue", () => { test("Button Text should revert to initial value when licensePlate textfield has new text", async () => { // Arrange @@ -294,7 +293,7 @@ describe("license-plate-lookup.vue", () => { }); }); -describe("license-plate-lookup.vue", () => { +describe.skip("license-plate-lookup.vue", () => { test("Button Text should revert to initial value when registrationZip textfield has new text", async () => { // Arrange @@ -311,7 +310,7 @@ describe("license-plate-lookup.vue", () => { }); }); -describe("license-plate-lookup.vue", () => { +describe.skip("license-plate-lookup.vue", () => { test("Button Text should revert to initial value when serviceZip textfield has new text", async () => { // Arrange @@ -328,7 +327,7 @@ describe("license-plate-lookup.vue", () => { }); }); -describe("license-plate-lookup.vue", () => { +describe.skip("license-plate-lookup.vue", () => { test("Dispatch reset damage and dependencies should be called if isCarIdDifferent is true and isSelectedGlassAvailableForVehicle is false when updateCustomerInfo is called", async () => { // Arrange @@ -351,7 +350,7 @@ describe("license-plate-lookup.vue", () => { }); }); -describe("license-plate-lookup.vue", () => { +describe.skip("license-plate-lookup.vue", () => { test("NavigateAfterSave should be called if isCarIdDifferent is true and isSelectedGlassAvailableForVehicle is false when navigateForward is called", async () => { // Arrange @@ -373,7 +372,7 @@ describe("license-plate-lookup.vue", () => { }); }); -describe("license-plate-lookup.vue", () => { +describe.skip("license-plate-lookup.vue", () => { test("navigateAfterSaveToHeritageFunnel should be called if isCarIdDifferent is false or isSelectedGlassAvailableForVehicle is true when navigateForward is called", async () => { // Arrange @@ -393,7 +392,7 @@ describe("license-plate-lookup.vue", () => { }); }); -describe("license-plate-lookup.vue", () => { +describe.skip("license-plate-lookup.vue", () => { test("dispatch non blocking store action called on validate zip", async () => { // Arrange @@ -408,7 +407,7 @@ describe("license-plate-lookup.vue", () => { }); }); -describe("license-plate-lookup.vue", () => { +describe.skip("license-plate-lookup.vue", () => { test("dispatch non blocking store action called on lookup vin", async () => { // Arrange @@ -466,4 +465,3 @@ function setupMocks({ return { wrapper, apiPromise }; } - */ \ No newline at end of file From b1e14f80df2d2ea2c6b7d13f832a165d9c4e2142 Mon Sep 17 00:00:00 2001 From: Donielle Austin Date: Wed, 18 May 2022 08:43:06 -0400 Subject: [PATCH 4/8] ga event defect --- src/layouts/address-lookup/address-lookup.vue | 9 ++++----- .../license-plate-lookup/license-plate-lookup.vue | 7 +++---- src/layouts/vin-lookup/vin-lookup.vue | 7 +++---- src/mixins/analytics-mixin.js | 9 +++++++-- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 87278476a..cebc7e414 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -153,16 +153,15 @@ export default { ); }, attachCustomEvents() { - this.prependActionToMethod(this, this.forwardButtonAction, this.logGAEventForVin()); - }, - logGAEventForVin(){ + this.prependActionToMethod(this, this.forwardButtonAction, () => { this.pushEventToGA( this.$route.query[this.queryStrings.FMG_PAGE], this.GaActions.SUBMITTED, this.GaLabels.ADDRESS_LOOKUP, true - ); - }, + ); + }); + }, getRegistrationAddressFromStore() { return store.getters.vehicle.registration.address; }, diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index 13f50ecc4..e76f05435 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -187,15 +187,14 @@ export default { store.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); }, attachCustomEvents() { - this.prependActionToMethod(this, this.forwardButtonAction, this.logGAEventForVin()); - }, - logGAEventForVin(){ + this.prependActionToMethod(this, this.forwardButtonAction, () => { this.pushEventToGA( this.$route.query[this.queryStrings.FMG_PAGE], this.GaActions.SUBMITTED, this.GaLabels.LICENSE_PLATE_LOOKUP, true - ); + ); + }); }, getLicensePlateFromStore() { return store.getters.vehicle.registration.licensePlate; diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 4dc1f6382..1ef501829 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -259,15 +259,14 @@ export default { return store.getters.order.serviceLocation.zipCode; }, attachCustomEvents() { - this.prependActionToMethod(this, this.forwardButtonAction, this.logGAEventForVin()); - }, - logGAEventForVin(){ - this.pushEventToGA( + this.prependActionToMethod(this, this.forwardButtonAction, () => { + this.pushEventToGA( this.$route.query[this.queryStrings.FMG_PAGE], this.GaActions.SUBMITTED, this.GaLabels.VIN_LOOKUP, true ); + }); }, backButtonAction() { this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index d13e1b222..926c4764c 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -97,8 +97,13 @@ export default { }, prependActionToMethod(object, method, actionToPrepend) { - const baseMethod = object[method.name]; - object[method.name] = function () { + var baseMethod = object[method.name]; + if(method.name.startsWith('bound ')){ + baseMethod = method.name.substring(6); + }else{ + baseMethod = object[method.name]; + } + object[method.name.substring(6)] = function () { actionToPrepend.apply(this, arguments); return baseMethod.apply(object, arguments); }; From e04979829a8631adb0124d49a402eba820ddd849 Mon Sep 17 00:00:00 2001 From: Donielle Austin Date: Wed, 18 May 2022 18:18:40 -0400 Subject: [PATCH 5/8] ga event defect --- src/layouts/address-lookup/address-lookup.vue | 11 +++--- .../license-plate-lookup.spec.js | 36 +++++++++---------- .../license-plate-lookup.vue | 9 ++--- src/layouts/vin-lookup/vin-lookup.vue | 9 ++--- src/mixins/analytics-mixin.js | 10 ++---- 5 files changed, 37 insertions(+), 38 deletions(-) diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 71e91f11a..e4db3aee6 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -151,11 +151,12 @@ export default { ); }, attachCustomEvents() { - this.prependActionToMethod(this, this.forwardButtonAction, () => { - this.pushEventToGA( - this.$route.query[this.queryStrings.FMG_PAGE], - this.GaActions.SUBMITTED, - this.GaLabels.ADDRESS_LOOKUP, + this.prependActionToMethod(this, this.forwardButtonAction, () => { + const self = this; + self.pushEventToGA( + self.$route.query[self.queryStrings.FMG_PAGE], + self.GaActions.SUBMITTED, + self.GaLabels.ADDRESS_LOOKUP, true ); }); diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js index 2d613c47a..281947ae4 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js +++ b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js @@ -47,7 +47,7 @@ jest.mock("@/store", () => ({ }, })); -describe.skip("license-plate-lookup.vue", () => { +describe("license-plate-lookup.vue", () => { test("CarId set, arePagePrerequisitesValid should be true ", async () => { //Arrange const { wrapper } = setupMocks({}); @@ -68,7 +68,7 @@ describe.skip("license-plate-lookup.vue", () => { }); }); -describe.skip("license-plate-lookup.vue", () => { +describe("license-plate-lookup.vue", () => { test("BackButtonAction triggers a router.navigate change", async () => { //Arrange @@ -89,7 +89,7 @@ describe.skip("license-plate-lookup.vue", () => { }); }); -describe.skip("license-plate-lookup.vue", () => { +describe("license-plate-lookup.vue", () => { test("getLicensePlateFromStore returns store license plate", async () => { // Arrange @@ -103,7 +103,7 @@ describe.skip("license-plate-lookup.vue", () => { }); }); -describe.skip("license-plate-lookup.vue", () => { +describe("license-plate-lookup.vue", () => { test("getRegistrationZipFromStore returns store registration zip", async () => { // Arrange @@ -117,7 +117,7 @@ describe.skip("license-plate-lookup.vue", () => { }); }); -describe.skip("license-plate-lookup.vue", () => { +describe("license-plate-lookup.vue", () => { test("getEmailFromStore returns store customer email", async () => { // Arrange @@ -131,7 +131,7 @@ describe.skip("license-plate-lookup.vue", () => { }); }); -describe.skip("license-plate-lookup.vue", () => { +describe("license-plate-lookup.vue", () => { test("getServiceZipFromStore returns store service zip", async () => { // Arrange @@ -145,7 +145,7 @@ describe.skip("license-plate-lookup.vue", () => { }); }); -describe.skip("license-plate-lookup.vue", () => { +describe("license-plate-lookup.vue", () => { test("Navigate forward should be called and isCarId should be set to false when data entered matches store data on forwardButtonAction click", async () => { // Arrange @@ -179,7 +179,7 @@ describe.skip("license-plate-lookup.vue", () => { }); }); -describe.skip("license-plate-lookup.vue", () => { +describe("license-plate-lookup.vue", () => { test("Function should stop and datam isRegistrationZipServicable should be set to false when service zip entered returns false on forwardButtonAction click", async () => { // Arrange @@ -207,7 +207,7 @@ describe.skip("license-plate-lookup.vue", () => { }); }); -describe.skip("license-plate-lookup.vue", () => { +describe("license-plate-lookup.vue", () => { test("Function should stop and datam isCarIdDifferent should be set to true when carId entered doesn't match store carId or previously entered carId on forwardButtonAction click", async () => { // Arrange @@ -241,7 +241,7 @@ describe.skip("license-plate-lookup.vue", () => { }); }); -describe.skip("license-plate-lookup.vue", () => { +describe("license-plate-lookup.vue", () => { test("Navigate forward should be called and isCarId should be set to true when carId entered matches previously entered carId and rest of data entered matches store data on forwardButtonAction click", async () => { // Arrange @@ -276,7 +276,7 @@ describe.skip("license-plate-lookup.vue", () => { }); }); -describe.skip("license-plate-lookup.vue", () => { +describe("license-plate-lookup.vue", () => { test("Button Text should revert to initial value when licensePlate textfield has new text", async () => { // Arrange @@ -293,7 +293,7 @@ describe.skip("license-plate-lookup.vue", () => { }); }); -describe.skip("license-plate-lookup.vue", () => { +describe("license-plate-lookup.vue", () => { test("Button Text should revert to initial value when registrationZip textfield has new text", async () => { // Arrange @@ -310,7 +310,7 @@ describe.skip("license-plate-lookup.vue", () => { }); }); -describe.skip("license-plate-lookup.vue", () => { +describe("license-plate-lookup.vue", () => { test("Button Text should revert to initial value when serviceZip textfield has new text", async () => { // Arrange @@ -327,7 +327,7 @@ describe.skip("license-plate-lookup.vue", () => { }); }); -describe.skip("license-plate-lookup.vue", () => { +describe("license-plate-lookup.vue", () => { test("Dispatch reset damage and dependencies should be called if isCarIdDifferent is true and isSelectedGlassAvailableForVehicle is false when updateCustomerInfo is called", async () => { // Arrange @@ -350,7 +350,7 @@ describe.skip("license-plate-lookup.vue", () => { }); }); -describe.skip("license-plate-lookup.vue", () => { +describe("license-plate-lookup.vue", () => { test("NavigateAfterSave should be called if isCarIdDifferent is true and isSelectedGlassAvailableForVehicle is false when navigateForward is called", async () => { // Arrange @@ -372,7 +372,7 @@ describe.skip("license-plate-lookup.vue", () => { }); }); -describe.skip("license-plate-lookup.vue", () => { +describe("license-plate-lookup.vue", () => { test("navigateAfterSaveToHeritageFunnel should be called if isCarIdDifferent is false or isSelectedGlassAvailableForVehicle is true when navigateForward is called", async () => { // Arrange @@ -392,7 +392,7 @@ describe.skip("license-plate-lookup.vue", () => { }); }); -describe.skip("license-plate-lookup.vue", () => { +describe("license-plate-lookup.vue", () => { test("dispatch non blocking store action called on validate zip", async () => { // Arrange @@ -407,7 +407,7 @@ describe.skip("license-plate-lookup.vue", () => { }); }); -describe.skip("license-plate-lookup.vue", () => { +describe("license-plate-lookup.vue", () => { test("dispatch non blocking store action called on lookup vin", async () => { // Arrange diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index 17aa1b632..3748ac776 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -229,10 +229,11 @@ export default { }, attachCustomEvents() { this.prependActionToMethod(this, this.forwardButtonAction, () => { - this.pushEventToGA( - this.$route.query[this.queryStrings.FMG_PAGE], - this.GaActions.SUBMITTED, - this.GaLabels.LICENSE_PLATE_LOOKUP, + const self = this; + self.pushEventToGA( + self.$route.query[self.queryStrings.FMG_PAGE], + self.GaActions.SUBMITTED, + self.GaLabels.LICENSE_PLATE_LOOKUP, true ); }); diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index e19a86e68..8e21e3d04 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -277,10 +277,11 @@ export default { }, attachCustomEvents() { this.prependActionToMethod(this, this.forwardButtonAction, () => { - this.pushEventToGA( - this.$route.query[this.queryStrings.FMG_PAGE], - this.GaActions.SUBMITTED, - this.GaLabels.VIN_LOOKUP, + const self = this; + self.pushEventToGA( + self.$route.query[self.queryStrings.FMG_PAGE], + self.GaActions.SUBMITTED, + self.GaLabels.VIN_LOOKUP, true ); }); diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index 926c4764c..6ceb3b48f 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -97,13 +97,9 @@ export default { }, prependActionToMethod(object, method, actionToPrepend) { - var baseMethod = object[method.name]; - if(method.name.startsWith('bound ')){ - baseMethod = method.name.substring(6); - }else{ - baseMethod = object[method.name]; - } - object[method.name.substring(6)] = function () { + let baseMethodName = method.name.startsWith('bound ') ? method.name.substring(6) : method.name ; + const baseMethod = object[baseMethodName]; + object[baseMethodName] = function () { actionToPrepend.apply(this, arguments); return baseMethod.apply(object, arguments); }; From e83710fb024653e3a0683d26da05c5e27c233da6 Mon Sep 17 00:00:00 2001 From: Donielle Austin Date: Thu, 19 May 2022 08:30:54 -0400 Subject: [PATCH 6/8] ga defect --- src/layouts/address-lookup/address-lookup.vue | 9 ++++----- .../license-plate-lookup/license-plate-lookup.vue | 9 ++++----- src/layouts/vin-lookup/vin-lookup.vue | 9 ++++----- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index e4db3aee6..f6e0d2b3d 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -152,11 +152,10 @@ export default { }, attachCustomEvents() { this.prependActionToMethod(this, this.forwardButtonAction, () => { - const self = this; - self.pushEventToGA( - self.$route.query[self.queryStrings.FMG_PAGE], - self.GaActions.SUBMITTED, - self.GaLabels.ADDRESS_LOOKUP, + this.pushEventToGA( + this.$route.query[this.queryStrings.FMG_PAGE], + this.GaActions.SUBMITTED, + this.GaLabels.ADDRESS_LOOKUP, true ); }); diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index 3748ac776..17aa1b632 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -229,11 +229,10 @@ export default { }, attachCustomEvents() { this.prependActionToMethod(this, this.forwardButtonAction, () => { - const self = this; - self.pushEventToGA( - self.$route.query[self.queryStrings.FMG_PAGE], - self.GaActions.SUBMITTED, - self.GaLabels.LICENSE_PLATE_LOOKUP, + this.pushEventToGA( + this.$route.query[this.queryStrings.FMG_PAGE], + this.GaActions.SUBMITTED, + this.GaLabels.LICENSE_PLATE_LOOKUP, true ); }); diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 8e21e3d04..e19a86e68 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -277,11 +277,10 @@ export default { }, attachCustomEvents() { this.prependActionToMethod(this, this.forwardButtonAction, () => { - const self = this; - self.pushEventToGA( - self.$route.query[self.queryStrings.FMG_PAGE], - self.GaActions.SUBMITTED, - self.GaLabels.VIN_LOOKUP, + this.pushEventToGA( + this.$route.query[this.queryStrings.FMG_PAGE], + this.GaActions.SUBMITTED, + this.GaLabels.VIN_LOOKUP, true ); }); From 4715698f8e5cc1c750cad0fa67092493063b8ced Mon Sep 17 00:00:00 2001 From: Donielle Austin Date: Thu, 19 May 2022 08:36:22 -0400 Subject: [PATCH 7/8] ga defect --- src/mixins/analytics-mixin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index 6ceb3b48f..133187797 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -97,7 +97,7 @@ export default { }, prependActionToMethod(object, method, actionToPrepend) { - let baseMethodName = method.name.startsWith('bound ') ? method.name.substring(6) : method.name ; + const baseMethodName = method.name.startsWith('bound ') ? method.name.substring(6) : method.name ; const baseMethod = object[baseMethodName]; object[baseMethodName] = function () { actionToPrepend.apply(this, arguments); From 548310887bc790306d6d07f0cfe5904a782560b2 Mon Sep 17 00:00:00 2001 From: Donielle Austin Date: Thu, 19 May 2022 09:25:15 -0400 Subject: [PATCH 8/8] ga defect tests --- src/mixins/analytics-mixin.spec.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/mixins/analytics-mixin.spec.js b/src/mixins/analytics-mixin.spec.js index e63778466..8dd49045d 100644 --- a/src/mixins/analytics-mixin.spec.js +++ b/src/mixins/analytics-mixin.spec.js @@ -107,4 +107,17 @@ describe("analyticsMixin.js", () => { }]); }); + + test("Obj is not null after action prepended", () => { + //Arrange + const obj = {baseMethodName:"testMethodName", data:"testData"}; + const method = {name:"testMethodName", data:"testData" } + const action = "testAction"; + + //Act + analyticsMixin.methods.prependActionToMethod(obj, method, action); + + //Assert + expect(obj!=null); + }); }); \ No newline at end of file