+
diff --git a/src/layouts/vehicle-year/vehicle-year.spec.js b/src/layouts/vehicle-year/vehicle-year.spec.js
index 27b84ed5f..f38e0a917 100644
--- a/src/layouts/vehicle-year/vehicle-year.spec.js
+++ b/src/layouts/vehicle-year/vehicle-year.spec.js
@@ -1,55 +1,52 @@
-import { shallowMount } from '@vue/test-utils';
-import { nextTick } from 'vue'
-import { getMountOptions } from '@/helpers/unitTestHelper.js';
-import { storeActions } from '@/constants/storeActions.js'
-import selectYear from './selectYear.vue';
+import { shallowMount } from "@vue/test-utils";
+import { nextTick } from "vue";
+import { getMountOptions } from "@/helpers/unitTestHelper.js";
+import { storeActions } from "@/constants/storeActions.js";
+import selectYear from "./selectYear.vue";
-describe('selectYear.vue', () => {
- test("Should render the 'pageHeader.Text' data value 'text' prop value for the Header component, 'radioQuestion.Question' data value as 'questionText' prop value for the 'radioQuestion' component and 'years' values for 'answers' prop values for the 'radioQuestion' component.", async () => {
-
- // Arrange
- const mockDataAndAction = {
- actionList: [
- {
- actionName: storeActions.GET_PAGE_DATA,
- data: {
- "Result": [
- {
- Type: "PageHeadingWidget",
- Model: {
- Text: "Mock Data"
- }
- },
- {
- Type: "RadioQuestionWidget",
- Model: {
- Question: "Mock Data"
- }
- }
- ]
- }
+describe("selectYear.vue", () => {
+ test("Should render the 'pageHeader.Text' data value 'text' prop value for the Header component, 'radioQuestion.Question' data value as 'questionText' prop value for the 'radioQuestion' component and 'years' values for 'answers' prop values for the 'radioQuestion' component.", async () => {
+ // Arrange
+ const mockDataAndAction = {
+ actionList: [
+ {
+ actionName: storeActions.GET_PAGE_DATA,
+ data: {
+ Result: [
+ {
+ Type: "PageHeadingWidget",
+ Model: {
+ Text: "Mock Data",
},
- {
- actionName: storeActions.GET_YEARS,
- data: ['2023', '2022', '2021']
- }
- ]
- };
+ },
+ {
+ Type: "RadioQuestionWidget",
+ Model: {
+ Question: "Mock Data",
+ },
+ },
+ ],
+ },
+ },
+ {
+ actionName: storeActions.GET_VEHICLE_YEARS,
+ data: ["2023", "2022", "2021"],
+ },
+ ],
+ };
- const mountOptions = getMountOptions(mockDataAndAction);
+ const mountOptions = getMountOptions(mockDataAndAction);
- // Act
- const wrapper = shallowMount(selectYear, mountOptions);
- await nextTick()
+ // Act
+ const wrapper = shallowMount(selectYear, mountOptions);
+ await nextTick();
- // Assert
- const header = await wrapper.find('.Header');
- expect(header.attributes('text')).toEqual("Mock Data");
+ // Assert
+ const header = await wrapper.find(".Header");
+ expect(header.attributes("text")).toEqual("Mock Data");
- const radioQuestion = await wrapper.findComponent('.radioQuestion');
- expect(radioQuestion.attributes('answers')).toEqual('2023,2022,2021');
- expect(radioQuestion.attributes('questiontext')).toEqual("Mock Data");
- });
-
-
-})
\ No newline at end of file
+ const radioQuestion = await wrapper.findComponent(".radioQuestion");
+ expect(radioQuestion.attributes("answers")).toEqual("2023,2022,2021");
+ expect(radioQuestion.attributes("questiontext")).toEqual("Mock Data");
+ });
+});
diff --git a/src/layouts/vehicle-year/vehicle-year.vue b/src/layouts/vehicle-year/vehicle-year.vue
index 24df9fe74..ca96b6271 100644
--- a/src/layouts/vehicle-year/vehicle-year.vue
+++ b/src/layouts/vehicle-year/vehicle-year.vue
@@ -1,8 +1,8 @@
-
-
+
@@ -10,33 +10,25 @@
diff --git a/src/layouts/vehicle-year/year-question/year-question.vue b/src/layouts/vehicle-year/year-question/year-question.vue
index 4dbad4e38..3cbcd9696 100644
--- a/src/layouts/vehicle-year/year-question/year-question.vue
+++ b/src/layouts/vehicle-year/year-question/year-question.vue
@@ -8,37 +8,25 @@ import store from "@/store";
import router from "@/router";
export default {
- name: 'year-question',
+ name: "year-question",
props: {
- questionText: String
+ questionText: String,
},
data() {
return {
- years: []
- }
+ years: [],
+ };
},
- created() {
- this.dispatchNonBlockingStoreAction(this.storeActions.GET_YEARS)
- .then((response) => {
- this.years = response.data;
- });
+ mounted() {
+ this.dispatchNonBlockingStoreAction(this.storeActions.GET_VEHICLE_YEARS, {}
+ ).then((response) => {
+ this.years = response.data;
+ });
},
components: {
- radioQuestion
+ radioQuestion,
},
methods: {
- selectYear(year) {
- this.dispatchNonBlockingStoreAction("selectYear", {
- year: year
- }).then((response) => {
- const makes = response;
- store.commit('updateYear', {
- year,
- makes
- });
- router.push(`select-make?year=${year}`);
- });
- }
- }
-}
+ },
+};
diff --git a/src/main.js b/src/main.js
index 784b51717..87994096f 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,7 +1,7 @@
import { createApp } from "vue";
import App from "./App.vue";
-import router from './router';
-import store from '@/store';
+import router from "./router";
+import store from "@/store";
import baseMixin from "@/mixins/baseMixin.js";
//Bootstrap JavaScript
import "../node_modules/bootstrap/dist/js/bootstrap.js";
diff --git a/src/mixins/baseMixin.js b/src/mixins/baseMixin.js
index 600e489d1..1f51eb346 100644
--- a/src/mixins/baseMixin.js
+++ b/src/mixins/baseMixin.js
@@ -2,62 +2,61 @@ import { storeActions } from "@/constants/storeActions.js";
import { widgetNames } from "@/constants/widgetNames.js";
export default {
- methods: {
- dispatchBlockingStoreAction(type, payload) {
- // globalMethods.showWaitingModal(true);
+ methods: {
+ dispatchBlockingStoreAction(type, payload) {
+ // globalMethods.showWaitingModal(true);
- return this.dispatchNonBlockingStoreAction(type, payload)
- .finally(() => {
- // globalMethods.showWaitingModal(false);
- });;
- },
- dispatchNonBlockingStoreAction(type, payload, encodePayload = false) {
+ return this.dispatchNonBlockingStoreAction(type, payload).finally(() => {
+ // globalMethods.showWaitingModal(false);
+ });
+ },
+ dispatchNonBlockingStoreAction(type, payload, encodePayload = false) {
+ // Encode the payload if required
+ if (encodePayload) {
+ encodeUriData(payload);
+ }
- // Encode the payload if required
- if (encodePayload) {
- encodeUriData(payload);
+ return this.$store.dispatch(type, payload);
+ },
+
+ GetContentFromCms() {
+ return this.dispatchNonBlockingStoreAction(
+ this.storeActions.GET_PAGE_DATA,
+ { pageName: this.$route.query.fmgPage }
+ ).then((response) => {
+ const pageDataFromCms = {};
+
+ response.data.Result.forEach((widget) => {
+ if (Object.values(this.widgetNames).includes(widget.Type)) {
+ // If we already have this widget, push it on the collection
+ if (widget.Type in pageDataFromCms) {
+ pageDataFromCms[widget.Type].push(widget.Model);
+ return;
}
- return this.$store.dispatch(type, payload);
- },
+ pageDataFromCms[widget.Type] = [widget.Model];
+ }
+ });
- GetContentFromCms() {
- return this.dispatchNonBlockingStoreAction(this.storeActions.GET_PAGE_DATA, { pageName: this.$route.query.fmgPage })
- .then((response) => {
-
- const pageDataFromCms = {};
-
- response.data.Result.forEach((widget) => {
- if (Object.values(this.widgetNames).includes(widget.Type)) {
- // If we already have this widget, push it on the collection
- if (widget.Type in pageDataFromCms) {
- pageDataFromCms[widget.Type].push(widget.Model);
- return;
- }
-
- pageDataFromCms[widget.Type] = [widget.Model];
- }
- });
-
- return pageDataFromCms;
- });
- }
+ return pageDataFromCms;
+ });
},
- computed: {
- storeActions() {
- return storeActions;
- },
- widgetNames() {
- return widgetNames;
- }
+ },
+ computed: {
+ storeActions() {
+ return storeActions;
},
-}
+ widgetNames() {
+ return widgetNames;
+ },
+ },
+};
function encodeUriData(payload) {
- if (payload && Object.keys(payload).length > 0) {
- // Loop through the payload and encode the values
- Object.keys(payload).forEach(key => {
- payload[key] = encodeURIComponent(payload[key]);
- });
- }
-}
\ No newline at end of file
+ if (payload && Object.keys(payload).length > 0) {
+ // Loop through the payload and encode the values
+ Object.keys(payload).forEach((key) => {
+ payload[key] = encodeURIComponent(payload[key]);
+ });
+ }
+}
diff --git a/src/router/index.js b/src/router/index.js
index 415fb0292..8931e0463 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -7,9 +7,9 @@ import store from "@/store";
const routes = [
{
- path: '/:pathMatch(.*)*',
+ path: "/:pathMatch(.*)*",
component: NotFound,
- name: "NotFound"
+ name: "NotFound",
},
{
path: "/component-test", // This is a temporary route for testing.
@@ -19,12 +19,10 @@ const routes = [
{
path: "/",
beforeEnter(to, from, next) {
-
// If we have no query string, or we don't have the FmgPage query string.
if (to.query.fmgPage === undefined) {
RetainStructureAndGoTo404(to, next);
} else {
-
// If we already have our route, go to it.
if (router.hasRoute(to.query.fmgPage)) {
return next({
@@ -34,24 +32,22 @@ const routes = [
}
// Get route info for the given url. Names will have a 1:1 relationship with names in the Cms.
- GetRouteInfoFromPageName(to.query.fmgPage).then((routeData) => {
+ GetRouteInfoFromPageName(to.query.fmgPage)
+ .then((routeData) => {
+ // Add our dynamic route.
+ router.addRoute({
+ path: routeData[0].path, // Always the same path, because we control it with query strings.
+ name: routeData[0].name,
+ component: routeData[0].component,
+ });
- // Add our dynamic route.
- router.addRoute({
- path: routeData[0].path, // Always the same path, because we control it with query strings.
- name: routeData[0].name,
- component: routeData[0].component,
- });
-
- // Assign current query string parameters, as well as our fmgPage one.
- next({
- name: routeData[0].name,
- query: Object.assign(to.query, { fmgPage: routeData[0].name })
- });
-
- })
+ // Assign current query string parameters, as well as our fmgPage one.
+ next({
+ name: routeData[0].name,
+ query: Object.assign(to.query, { fmgPage: routeData[0].name }),
+ });
+ })
.catch((error) => {
-
// If we can't find the route, go to the 404 page.
RetainStructureAndGoTo404(to, next);
@@ -68,7 +64,7 @@ const router = createRouter({
routes,
});
-// Get route information by page name.
+// Get route information by page name.
// This will reach out to the Cms and there is a 1:1 relationship between page names and route names.
function GetRouteInfoFromPageName(pageName) {
return new Promise((resolve, reject) => {
@@ -81,14 +77,13 @@ function GetRouteInfoFromPageName(pageName) {
Object.keys(jsonFromResponse).forEach((key) => {
routeData.push({
- path: '/',
+ path: "/",
name: `${key}`,
component: lazyLoadComponent(jsonFromResponse[key].LayoutName),
});
});
resolve(routeData);
-
})
.catch((error) => {
reject(error);
@@ -99,10 +94,10 @@ function GetRouteInfoFromPageName(pageName) {
// Go to our 404 page but retain our structure when we go there (path, queryString, hash).
function RetainStructureAndGoTo404(to, next) {
next({
- name: 'NotFound',
- params: { pathMatch: to.path.split('/').slice(1) },
+ name: "NotFound",
+ params: { pathMatch: to.path.split("/").slice(1) },
query: to.query,
- hash: to.hash
+ hash: to.hash,
});
}
diff --git a/src/store/index.js b/src/store/index.js
index 1e7ab1024..87c8a35da 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -9,23 +9,44 @@ export default createStore({
storage: window.sessionStorage,
}),
],
- state: {
- },
- mutations: {
- },
+ state: {},
+ mutations: {},
actions: {
- getVehicleModels({ commit, state }, { year, make }) {
- console.log(arguments);
+ // Vehicle API Actions
+ getVehicleYears(context) {
return globalMethods.callHttpClient({
- method: endpoints.GetVehicleModels.method,
- endpoint: `${endpoints.GetVehicleModels.url}/${year}/${encodeURI(make)}`,
- payload: {}
+ method: endpoints.GetVehicleYears.method,
+ endpoint: endpoints.GetVehicleYears.url,
+ payload: {},
});
},
+ getVehicleMakes(context, { year }) {
+ return globalMethods.callHttpClient({
+ method: endpoints.GetVehicleMakes.method,
+ endpoint: `${endpoints.GetVehicleMakes.url}/${year}`,
+ payload: {},
+ });
+ },
+ getVehicleModels(context, { year, make }) {
+ return globalMethods.callHttpClient({
+ method: endpoints.GetVehicleModels.method,
+ endpoint: `${endpoints.GetVehicleModels.url}/${year}/${make}`,
+ payload: {},
+ });
+ },
+ getVehicleStyles(context, { year, make, model }) {
+ return globalMethods.callHttpClient({
+ method: endpoints.GetVehicleStyles.method,
+ endpoint: `${endpoints.GetVehicleStyles.url}/${year}/${make}/${model}`,
+ payload: {},
+ });
+ },
+
+ // Content API Actions
getRouteInfo(context, { pageName }) {
return globalMethods.callHttpClient({
- method: endpoints.GetRouteInfoEndpoint.method,
- endpoint: endpoints.GetRouteInfoEndpoint.url,
+ method: endpoints.GetRouteInfo.method,
+ endpoint: endpoints.GetRouteInfo.url,
payload: {
pageName: pageName,
},
@@ -34,7 +55,7 @@ export default createStore({
getPageData(context, { pageName }) {
return globalMethods.callHttpClient({
method: endpoints.GetPageData.method,
- endpoint: endpoints.GetPageData.url.replace("{pageName}", pageName),
+ endpoint: `${endpoints.GetPageData.url}/${pageName}`,
payload: {},
});
},
diff --git a/src/uxComponents/buttonPrimary/buttonPrimary.spec.js b/src/uxComponents/buttonPrimary/buttonPrimary.spec.js
index 882a68129..3d0843e10 100644
--- a/src/uxComponents/buttonPrimary/buttonPrimary.spec.js
+++ b/src/uxComponents/buttonPrimary/buttonPrimary.spec.js
@@ -1 +1 @@
-test.todo('some test to be written in the future');
\ No newline at end of file
+test.todo("some test to be written in the future");
diff --git a/src/uxComponents/buttonPrimary/buttonPrimary.vue b/src/uxComponents/buttonPrimary/buttonPrimary.vue
index 9741d9c49..1f5738cb8 100644
--- a/src/uxComponents/buttonPrimary/buttonPrimary.vue
+++ b/src/uxComponents/buttonPrimary/buttonPrimary.vue
@@ -5,7 +5,7 @@
class="btn btn-primary d-flex align-items-center"
v-on:click="showLoader()"
v-bind:class="[this.isLoading ? 'button-loader' : 'not-loading']"
- >
+ >
{{ this.buttonText }}
@@ -15,11 +15,11 @@ export default {
name: "buttonPrimary",
props: {
buttonText: String,
- isDisabled: Boolean
+ isDisabled: Boolean,
},
data() {
return {
- isLoading: false
+ isLoading: false,
};
},
methods: {
diff --git a/src/uxComponents/buttonSecondary/buttonSecondary.spec.js b/src/uxComponents/buttonSecondary/buttonSecondary.spec.js
index 882a68129..3d0843e10 100644
--- a/src/uxComponents/buttonSecondary/buttonSecondary.spec.js
+++ b/src/uxComponents/buttonSecondary/buttonSecondary.spec.js
@@ -1 +1 @@
-test.todo('some test to be written in the future');
\ No newline at end of file
+test.todo("some test to be written in the future");
diff --git a/src/uxComponents/buttonSecondary/buttonSecondary.vue b/src/uxComponents/buttonSecondary/buttonSecondary.vue
index 19961efa0..3840922d4 100644
--- a/src/uxComponents/buttonSecondary/buttonSecondary.vue
+++ b/src/uxComponents/buttonSecondary/buttonSecondary.vue
@@ -5,7 +5,7 @@
class="btn btn-secondary d-flex align-items-center"
v-on:click="showLoader()"
v-bind:class="[this.isLoading ? 'button-loader' : 'not-loading']"
- >
+ >
{{ this.buttonText }}
@@ -14,7 +14,7 @@
export default {
name: "buttonSecondary",
props: {
- buttonText: String
+ buttonText: String,
},
data() {
return {
diff --git a/src/uxComponents/confetti/confetti.spec.js b/src/uxComponents/confetti/confetti.spec.js
index 882a68129..3d0843e10 100644
--- a/src/uxComponents/confetti/confetti.spec.js
+++ b/src/uxComponents/confetti/confetti.spec.js
@@ -1 +1 @@
-test.todo('some test to be written in the future');
\ No newline at end of file
+test.todo("some test to be written in the future");
diff --git a/src/uxComponents/header/header.spec.js b/src/uxComponents/header/header.spec.js
index d02c78d9f..f5a423803 100644
--- a/src/uxComponents/header/header.spec.js
+++ b/src/uxComponents/header/header.spec.js
@@ -1,16 +1,16 @@
-import { shallowMount } from '@vue/test-utils';
-import Header from './header';
+import { shallowMount } from "@vue/test-utils";
+import Header from "./header";
-describe('Header.vue', () => {
- it("Should render the 'text' prop value as a span value for the header span text value.", () => {
- // Act
- const wrapper = shallowMount(Header, {
- propsData: {
- text: 'Header Content'
- }
- });
+describe("Header.vue", () => {
+ it("Should render the 'text' prop value as a span value for the header span text value.", () => {
+ // Act
+ const wrapper = shallowMount(Header, {
+ propsData: {
+ text: "Header Content",
+ },
+ });
- // Assert
- expect(wrapper.find('span').text()).toContain("Header Content");
- })
-});
\ No newline at end of file
+ // Assert
+ expect(wrapper.find("span").text()).toContain("Header Content");
+ });
+});
diff --git a/src/uxComponents/header/header.vue b/src/uxComponents/header/header.vue
index a2a68eeb7..621e4c917 100644
--- a/src/uxComponents/header/header.vue
+++ b/src/uxComponents/header/header.vue
@@ -1,16 +1,16 @@
-
-
- {{ text }}
-
+
+
+ {{ text }}
+
\ No newline at end of file
+
diff --git a/src/uxComponents/listButton/listButton.spec.js b/src/uxComponents/listButton/listButton.spec.js
index e360d0fc1..3d0843e10 100644
--- a/src/uxComponents/listButton/listButton.spec.js
+++ b/src/uxComponents/listButton/listButton.spec.js
@@ -1 +1 @@
-test.todo('some test to be written in the future');
+test.todo("some test to be written in the future");
diff --git a/src/uxComponents/listButton/listButton.vue b/src/uxComponents/listButton/listButton.vue
index e6297fe60..2580b0f83 100644
--- a/src/uxComponents/listButton/listButton.vue
+++ b/src/uxComponents/listButton/listButton.vue
@@ -3,8 +3,11 @@
@@ -16,12 +19,12 @@ export default {
name: "listButton",
props: {
buttonText: String,
- errorText: String
+ errorText: String,
},
data() {
return {
isLoading: false,
- isError: false
+ isError: false,
};
},
methods: {
diff --git a/src/uxComponents/radio/radio.spec.js b/src/uxComponents/radio/radio.spec.js
index ba59e2650..35ddfdab7 100644
--- a/src/uxComponents/radio/radio.spec.js
+++ b/src/uxComponents/radio/radio.spec.js
@@ -1,23 +1,23 @@
-import { shallowMount } from '@vue/test-utils';
-import radio from './radio';
+import { shallowMount } from "@vue/test-utils";
+import radio from "./radio";
-describe('radio.vue', () => {
- it("Should render the 'text' prop value as a span value for the radio button label and add the 'value' prop value as the radio button value and id.", () => {
- // Act
- const wrapper = shallowMount(radio, {
- propsData: {
- value: '2023',
- text: '12'
- }
- });
+describe("radio.vue", () => {
+ it("Should render the 'text' prop value as a span value for the radio button label and add the 'value' prop value as the radio button value and id.", () => {
+ // Act
+ const wrapper = shallowMount(radio, {
+ propsData: {
+ value: "2023",
+ text: "12",
+ },
+ });
- // Assert
- expect(wrapper.find('span').text()).toEqual('12');
- expect(wrapper.find('input').attributes()).toEqual({
- class: 'position-absolute opacity-0',
- id: '2023',
- type: 'radio',
- value: '2023'
- });
- })
-})
\ No newline at end of file
+ // Assert
+ expect(wrapper.find("span").text()).toEqual("12");
+ expect(wrapper.find("input").attributes()).toEqual({
+ class: "position-absolute opacity-0",
+ id: "2023",
+ type: "radio",
+ value: "2023",
+ });
+ });
+});
diff --git a/src/uxComponents/radio/radio.vue b/src/uxComponents/radio/radio.vue
index 1f4e63f39..ac005bca4 100644
--- a/src/uxComponents/radio/radio.vue
+++ b/src/uxComponents/radio/radio.vue
@@ -1,30 +1,26 @@
-
+
-
-
+
\ No newline at end of file
+
diff --git a/src/uxComponents/radioList/radioList.spec.js b/src/uxComponents/radioList/radioList.spec.js
index 882a68129..3d0843e10 100644
--- a/src/uxComponents/radioList/radioList.spec.js
+++ b/src/uxComponents/radioList/radioList.spec.js
@@ -1 +1 @@
-test.todo('some test to be written in the future');
\ No newline at end of file
+test.todo("some test to be written in the future");
diff --git a/src/uxComponents/radioList/radioList.vue b/src/uxComponents/radioList/radioList.vue
index 6b59e6f57..867892df9 100644
--- a/src/uxComponents/radioList/radioList.vue
+++ b/src/uxComponents/radioList/radioList.vue
@@ -1,28 +1,36 @@