From e04979829a8631adb0124d49a402eba820ddd849 Mon Sep 17 00:00:00 2001 From: Donielle Austin Date: Wed, 18 May 2022 18:18:40 -0400 Subject: [PATCH] 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); };