diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js
index 60300f78c..db80d3d3f 100644
--- a/src/constants/store-actions.js
+++ b/src/constants/store-actions.js
@@ -7,7 +7,7 @@ const storeActions = {
GET_VEHICLE_STYLES: "getVehicleStyles",
GET_EVOX_IMAGE: "getEvoxImage",
LOOKUP_VEHICLE_BY_YMMS: "lookupVehicleByYmms",
- LOOKUP_VEHICLE_BY_VIN: "lookupVehicleByVin"
+ LOOKUP_VEHICLE_BY_VIN: "lookupVehicleByVin",
};
export { storeActions };
diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js
new file mode 100644
index 000000000..6ade6cd1d
--- /dev/null
+++ b/src/constants/store-mutations.js
@@ -0,0 +1,5 @@
+const storeMutations = {
+ UPDATE_YEAR: "updateYear",
+}
+
+export { storeMutations };
\ No newline at end of file
diff --git a/src/layouts/component-test/component-test.vue b/src/layouts/component-test/component-test.vue
index b25a26b8f..134604ad6 100644
--- a/src/layouts/component-test/component-test.vue
+++ b/src/layouts/component-test/component-test.vue
@@ -73,7 +73,7 @@
Select Vehicle Year
-
-
-
{
@@ -19,10 +20,12 @@ describe('year-question.vue', () => {
const wrapper = shallowMount(yearQuestion, mountOptions);
await wrapper.setProps({questionText: 'What year is your vehicle?'})
await flushPromises();
+ wrapper.vm.selectYear(2020);
// Assert
const radioQuestion = await wrapper.findComponent({name: 'radioQuestion'});
expect(radioQuestion.attributes('questiontext')).toBe("What year is your vehicle?");
expect(radioQuestion.attributes('answers')).toBe('2023,2022,2021');
+ expect(store.state.order.vehicle.year).toBe(2020);
});
});
diff --git a/src/layouts/vehicle-year/year-question/year-question.vue b/src/layouts/vehicle-year/year-question/year-question.vue
index 4aedb12df..d59df5e00 100644
--- a/src/layouts/vehicle-year/year-question/year-question.vue
+++ b/src/layouts/vehicle-year/year-question/year-question.vue
@@ -1,5 +1,9 @@
-
+
diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js
index 81a191aa5..586e8c08e 100644
--- a/src/mixins/base-mixin.js
+++ b/src/mixins/base-mixin.js
@@ -1,4 +1,5 @@
import { storeActions } from "@/constants/store-actions.js";
+import { storeMutations } from "@/constants/store-mutations.js";
import { widgetNames } from "@/constants/widget-names.js";
export default {
@@ -53,6 +54,9 @@ export default {
storeActions() {
return storeActions;
},
+ storeMutations() {
+ return storeMutations;
+ },
widgetNames() {
return widgetNames;
},
diff --git a/src/store/index.js b/src/store/index.js
index 0976690b7..bbeaab714 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -64,6 +64,9 @@ export default createStore({
}
},
mutations: {
+ updateYear(state, year){
+ state.order.vehicle.year = year;
+ },
updateVehicleImage(state, data) {
state.order.vehicle.imageSrc = data.imgSrc;
},
@@ -138,6 +141,6 @@ export default createStore({
endpoint: relativeUrl,
payload: {},
});
- },
+ }
},
});
diff --git a/src/store/store.spec.js b/src/store/store.spec.js
index 3442d35bf..6e576b198 100644
--- a/src/store/store.spec.js
+++ b/src/store/store.spec.js
@@ -14,7 +14,6 @@ describe("Actions", () => {
await store.dispatch('getVehicleYears')
.then( (response) => {
years = response.data;
- console.log(response);
});
// Assert
@@ -109,4 +108,22 @@ describe("Actions", () => {
// Assert
expect(pageData).toBe('Page Info Data');
});
-})
\ No newline at end of file
+})
+
+describe("Mutations", () => {
+ it("Should update the year property in the store", () => {
+ // Act
+ store.commit('updateYear', 2020);
+
+ // Assert
+ expect(store.state.order.vehicle.year).toBe(2020);
+ });
+
+ it("Should update the vehicle image property in the store", () => {
+ // Act
+ store.commit('updateVehicleImage', {imgSrc: 'exampleimage@image.com'});
+
+ // Assert
+ expect(store.state.order.vehicle.imageSrc).toBe('exampleimage@image.com');
+ });
+});
\ No newline at end of file
diff --git a/src/ux-components/radio-list/radio-list.spec.js b/src/ux-components/radio-list/radio-list.spec.js
deleted file mode 100644
index 3d0843e10..000000000
--- a/src/ux-components/radio-list/radio-list.spec.js
+++ /dev/null
@@ -1 +0,0 @@
-test.todo("some test to be written in the future");
diff --git a/src/ux-components/radio-list/radio-list.vue b/src/ux-components/radio-list/radio-list.vue
deleted file mode 100644
index 2976ce87e..000000000
--- a/src/ux-components/radio-list/radio-list.vue
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-