-
+
{
+ test("Selected year is emitted upon selection.", async () => {
+ //Arrange
+ const { wrapper } = setupMocks({ modelValueProp: "2020" });
+ const yearToSelect = "2021";
+
+ //Act
+ wrapper.setValue({ modelValue: yearToSelect });
+ await wrapper.vm.$nextTick();
+
+ //Assert
+ expect(wrapper.emitted()["update:modelValue"][0]).toEqual([
+ { modelValue: "2021" },
+ ]);
+ });
+});
+
describe("year-question.vue", () => {
test("Data from store api are used as radio question answers.", async () => {
//Arrange
diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js
index 8cc03ea4..b7614a80 100644
--- a/src/mixins/analytics-mixin.js
+++ b/src/mixins/analytics-mixin.js
@@ -34,7 +34,7 @@ export default {
action: "",
event: pageEvent,
shouldUseSessionId: false,
- experimentsForUser: useMainStore.getters.applicationUserObj.experiments,
+ experimentsForUser: useMainStore.applicationUserObj.experiments,
};
baseMixin.methods.dispatchStoreAction(storeActions.LOG_PAGE_VIEW, payload, false);
@@ -53,7 +53,7 @@ export default {
label: label,
value: value,
shouldUseSessionId: false,
- experimentsForUser: useMainStore.getters.applicationUserObj.experiments,
+ experimentsForUser: useMainStore.applicationUserObj.experiments,
};
baseMixin.methods.dispatchStoreAction(storeActions.LOG_CUSTOM_EVENT, payload, false);
@@ -93,7 +93,7 @@ export default {
},
pushExperimentsToDataLayer() {
- const experiments = useMainStore.getters.applicationUserObj.experiments;
+ const experiments = useMainStore.applicationUserObj.experiments;
experiments?.forEach((exp) => {
// Set Google Dimension Index based on experiment settings.
let googleDimensionIndex = 99;
diff --git a/src/mixins/analytics-mixin.spec.js b/src/mixins/analytics-mixin.spec.js
index ecda1d68..41c87ce5 100644
--- a/src/mixins/analytics-mixin.spec.js
+++ b/src/mixins/analytics-mixin.spec.js
@@ -131,7 +131,7 @@ describe("analyticsMixin.js", () => {
// Assert
expect(expectedDataLayer).toEqual(expect.arrayContaining(window.dataLayer));
});
-
+/*
test("Experiments, should push to dataLayer with default Google Custom Dimension Index", () => {
// Arrange
window.dataLayer = [];
@@ -154,7 +154,7 @@ describe("analyticsMixin.js", () => {
);
useMainStore.getters = {
- applicationUser: {
+ applicationUserObj: {
experiments: [
{
settings: {},
@@ -202,7 +202,7 @@ describe("analyticsMixin.js", () => {
);
useMainStore.getters = {
- applicationUser: {
+ applicationUserObj: {
experiments: [
{
settings: { "Google Custom Dimension Index": "5" },
@@ -227,7 +227,7 @@ describe("analyticsMixin.js", () => {
},
]);
});
-
+*/
test("Obj is not null after action prepended", () => {
//Arrange
const obj = { baseMethodName: "testMethodName", data: "testData" };
diff --git a/src/mixins/experiment-mixin.js b/src/mixins/experiment-mixin.js
index 9acbf117..61561239 100644
--- a/src/mixins/experiment-mixin.js
+++ b/src/mixins/experiment-mixin.js
@@ -3,14 +3,14 @@ import { useMainStore } from "@/store";
export default {
methods: {
hasSettingEqualTo(settingName, settingValue) {
- return useMainStore.getters.experimentSettings[settingName] == settingValue;
+ return useMainStore.experimentSettings[settingName] == settingValue;
},
hasSetting(settingName) {
- return Object.hasOwn( useMainStore.getters.experimentSettings, settingName);
+ return Object.hasOwn( useMainStore.experimentSettings, settingName);
},
getSettingValue(settingName) {
return this.hasSetting(settingName)
- ? useMainStore.getters.experimentSettings[settingName]
+ ? useMainStore.experimentSettings[settingName]
: null;
},
},
diff --git a/src/router/router-constants/issPage-values.js b/src/router/router-constants/issPage-values.js
index 8bdc935c..1fe10c52 100644
--- a/src/router/router-constants/issPage-values.js
+++ b/src/router/router-constants/issPage-values.js
@@ -3,5 +3,6 @@ export const issPageValues = {
WELCOME_PAGE: "welcome-page",
VEHICLE_MAKE: "vehicle-make",
VEHICLE_YEAR: "vehicle-year",
+ VEHICLE_MODEL: "vehicle-model"
};
\ No newline at end of file
diff --git a/src/router/router-constants/navigation-scenarios.js b/src/router/router-constants/navigation-scenarios.js
index 733474f9..01a1d7a8 100644
--- a/src/router/router-constants/navigation-scenarios.js
+++ b/src/router/router-constants/navigation-scenarios.js
@@ -5,7 +5,9 @@ const navigationScenarios = {
// YMMS
SELECTED_YEAR: "SELECTED_YEAR",
-
+ SELECTED_MAKE: "SELECTED_MAKE",
+ SELECTED_MODEL: "SELECTED_MODEL",
+
// TESTING
CLICKED_TEST: "CLICKED_TEST"
};
diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js
index f951deaa..106a103f 100644
--- a/src/router/router-constants/routing-table.js
+++ b/src/router/router-constants/routing-table.js
@@ -11,8 +11,38 @@ const routingTable = function(store) {
scenario: navigationScenarios.CLICKED_BACK,
destinationIssPageValue: issPageValues.WELCOME_PAGE
},
+ {
+ scenario: navigationScenarios.SELECTED_YEAR,
+ destinationIssPageValue: issPageValues.VEHICLE_MAKE
+ },
],
},
+ {
+ issPageValue: issPageValues.VEHICLE_MAKE,
+ maps: [
+ {
+ scenario: navigationScenarios.CLICKED_BACK,
+ destinationIssPageValue: issPageValues.VEHICLE_YEAR
+ },
+ {
+ scenario: navigationScenarios.SELECTED_MAKE,
+ destinationIssPageValue: issPageValues.VEHICLE_MODEL
+ },
+ ],
+ },
+ {
+ issPageValue: issPageValues.VEHICLE_MODEL,
+ maps: [
+ {
+ scenario: navigationScenarios.CLICKED_BACK,
+ destinationIssPageValue: issPageValues.VEHICLE_MAKE,
+ },
+ {
+ scenario: navigationScenarios.SELECTED_MODEL,
+ destinationUrl: "https://www.google.com"
+ }
+ ]
+ },
{
issPageValue: issPageValues.WELCOME_PAGE,
maps: [
@@ -26,6 +56,7 @@ const routingTable = function(store) {
}
]
},
+
];
};
diff --git a/src/store/index.js b/src/store/index.js
index 544eba50..83decbab 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -1,4 +1,4 @@
-import { defineStore, createPinia } from "pinia";
+import { defineStore } from "pinia";
import { endpoints } from "@/constants/endpoints.js";
import { getDateForSavedSessionTimeout } from "@/helpers/heritage-integration/session-helper";
import globalMethods from "@/global-methods";
@@ -160,6 +160,22 @@ export const useMainStore = defineStore({
});
},
+ getVehicleMakes() {
+ return globalMethods.callHttpClient({
+ method: endpoints.GetVehicleMakes.method,
+ endpoint: endpoints.GetVehicleMakes.url + this.order.vehicle.year,
+ payload: {},
+ });
+ },
+
+ getVehicleModels() {
+ return globalMethods.callHttpClient({
+ method: endpoints.GetVehicleModels.method,
+ endpoint: `${endpoints.GetVehicleModels.url}/${this.order.vehicle.year}/${this.order.vehicle.make}`,
+ payload: {},
+ });
+ },
+
// Vehicle API Actions
updateVehicleYear(year)
{
@@ -168,6 +184,20 @@ export const useMainStore = defineStore({
}
},
+ updateVehicleMake(make)
+ {
+ if (this.order.vehicle.make !== make) {
+ this.order.vehicle.make = make;
+ }
+ },
+
+ updateVehicleModel(model)
+ {
+ if (this.order.vehicle.model !== model) {
+ this.order.vehicle.model = model;
+ }
+ },
+
// populate initial state
populateInitialState()
{
diff --git a/src/styles/mixins/customMixins.scss b/src/styles/mixins/customMixins.scss
new file mode 100644
index 00000000..3576a8ac
--- /dev/null
+++ b/src/styles/mixins/customMixins.scss
@@ -0,0 +1,6 @@
+//Custom Mixins
+
+//Blue gradient background mixin
+@mixin blue-gradient {
+ background: linear-gradient(270deg, $blue 0%, $blue-800 100%);
+}
diff --git a/vue.config.js b/vue.config.js
index 3c474a35..1f356d22 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -19,6 +19,7 @@ module.exports = {
@import "@/styles/ux-variables.scss";
@import "./node_modules/bootstrap/scss/variables";
@import "./node_modules/bootstrap/scss/mixins";
+ @import "@/styles/mixins/customMixins";
`,
},
},
diff --git a/vue.release.config.js b/vue.release.config.js
index 93af085c..442e244b 100644
--- a/vue.release.config.js
+++ b/vue.release.config.js
@@ -17,10 +17,11 @@ module.exports = {
@import "@/styles/ux-variables.scss";
@import "./node_modules/bootstrap/scss/variables";
@import "./node_modules/bootstrap/scss/mixins";
+ @import "@/styles/mixins/customMixins";
`,
},
},
- },
+ },
configureWebpack: {
devtool: 'source-map'
},