diff --git a/src/constants/analytics.js b/src/constants/analytics.js index 5400c7b7e..7ba9ef78c 100644 --- a/src/constants/analytics.js +++ b/src/constants/analytics.js @@ -31,6 +31,6 @@ const GaLabels = { const ValueToLogTypes = { LAST_5: "last_5", -} +}; export { analyticsPageEvents, GaCategories, GaActions, GaLabels, GaEvents, ValueToLogTypes }; diff --git a/src/helpers/unit-test-helper.js b/src/helpers/unit-test-helper.js index 368625e7b..67a3dc8ae 100644 --- a/src/helpers/unit-test-helper.js +++ b/src/helpers/unit-test-helper.js @@ -7,7 +7,7 @@ import { cookieNames } from "@/constants/cookie-names"; import { Form } from "vee-validate"; import baseMixin from "@/mixins/base-mixin"; import { getCookieDomainValue } from "@/helpers/heritage-integration/cookie-helper"; -import { analyticsPageEvents, GaCategories, GaActions, GaLabels, GaEvents, LabelToLogTypes } from "@/constants/analytics"; +import { analyticsPageEvents, GaCategories, GaActions, GaLabels, GaEvents, ValueToLogTypes } from "@/constants/analytics"; import { queryStrings } from "@/constants/query-strings"; import { routerParams } from "@/router/router-constants/router-params"; diff --git a/src/ux-components/radio/radio.spec.js b/src/ux-components/radio/radio.spec.js index f97700b0e..700a5cc82 100644 --- a/src/ux-components/radio/radio.spec.js +++ b/src/ux-components/radio/radio.spec.js @@ -1,6 +1,7 @@ import { shallowMount } from "@vue/test-utils"; import radio from "./radio"; import { nextTick } from "vue"; +import { GaActions } from "@/constants/analytics"; describe("radio.vue", () => { it("Should return group name", async () => { @@ -64,6 +65,13 @@ describe("radio.vue", () => { it("Should emit button value on click", async () => { // Act const wrapper = shallowMount(radio, { + global: { + mocks: { + '$route': { query: { fmgPage: 'page-name' } }, + GaActions: GaActions, + pushEventToGA: jest.fn(), + } + }, propsData: { buttonLabel: "Windshield", value: "List Card Checkbox", @@ -83,6 +91,13 @@ describe("radio.vue", () => { it("Should set checkValue data if selectedButtonIDs has value(s)", async () => { // Act const wrapper = shallowMount(radio, { + global: { + mocks: { + '$route': { query: { fmgPage: 'page-name' } }, + GaActions: GaActions, + pushEventToGA: jest.fn(), + } + }, propsData: { buttonLabel: "Windshield", buttonID: "List Card Checkbox", diff --git a/src/ux-components/radio/radio.vue b/src/ux-components/radio/radio.vue index 78df075df..be8441415 100644 --- a/src/ux-components/radio/radio.vue +++ b/src/ux-components/radio/radio.vue @@ -66,10 +66,10 @@ export default { buttonID: this.buttonID && this.buttonID.toString(), }; - this.pushEventToGA(this.$route.query[queryStrings.FMG_PAGE], this.GaActions.CLICKED, this.value.toString(), true, this.valueToLogType); - this.$emit("isCheckedChanged", emitEvent); this.$emit("update:modelValue", emitEvent); + + this.pushEventToGA(this.$route.query[queryStrings.FMG_PAGE], this.GaActions.CLICKED, this.value.toString(), true, this.valueToLogType); }, }, setup(props) {