changes for reviews
This commit is contained in:
parent
548a50ae48
commit
09c6744dd8
5 changed files with 19 additions and 35 deletions
|
|
@ -10,10 +10,10 @@
|
|||
export default {
|
||||
name: 'vehicle-year',
|
||||
components: { navButton },
|
||||
data: () => {
|
||||
return {
|
||||
navigationScenarios,
|
||||
data() {
|
||||
return {
|
||||
navigationScenarios,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
export default {
|
||||
name: "welcome-page",
|
||||
components: { navButton },
|
||||
data: () => {
|
||||
data() {
|
||||
return {
|
||||
navigationScenarios,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import { createWebHistory, createRouter } from "vue-router";
|
||||
import { lazyLoadComponent } from "./dynamic-routing/component-loader";
|
||||
import { endpoints } from "../constants/mock-endpoints";
|
||||
import { lazyLoadComponent } from "@/router/dynamic-routing/component-loader";
|
||||
import { endpoints } from "@/constants/mock-endpoints";
|
||||
import globalMethods from "@/global-methods";
|
||||
import {issPageValues} from '@/router/router-constants/issPage-values';
|
||||
import { routingTable } from "@/router/router-constants/routing-table";
|
||||
import { useMainStore } from '@/store';
|
||||
|
||||
const routes = [
|
||||
{
|
||||
|
|
@ -79,15 +80,21 @@ async function GetRouteInfoFromPageName(pageName) {
|
|||
return routeData;
|
||||
};
|
||||
|
||||
router.navigate = (scenario, currentRoute, optionalQuery = {}, optionalParams = {}) => {
|
||||
|
||||
navigate(scenario, currentRoute, false, optionalQuery, optionalParams);
|
||||
|
||||
}
|
||||
|
||||
// Navigate to the next route, depending on the scenario.
|
||||
router.navigate = async function (scenario, currentRoute, optionalQuery = {}, optionalParams = {}) {
|
||||
function navigate (scenario, currentRoute, optionalQuery = {}, optionalParams = {}) {
|
||||
if (!scenario) {
|
||||
console.error("No scenario provided. Please review the routing table.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Match our maps up and navigate if we have a destination.
|
||||
const matchingScenarioMap = router.getNavigationMap(scenario, currentRoute);
|
||||
const matchingScenarioMap = getNavigationMap(scenario, currentRoute);
|
||||
|
||||
if (!matchingScenarioMap){
|
||||
console.error("No matching scenario found. Please review the routing table.");
|
||||
|
|
@ -124,10 +131,10 @@ function navigateToUrl(url, optionalQuery = {}) {
|
|||
};
|
||||
|
||||
// Get navigation map depending on the scenario and the current 'page' you're on.
|
||||
router.getNavigationMap = function (scenario, currentRoute) {
|
||||
function getNavigationMap (scenario, currentRoute) {
|
||||
const issPageValue = currentRoute.query.issPage;
|
||||
try {
|
||||
const matchedQueryValue = routingTable()
|
||||
const matchedQueryValue = routingTable(useMainStore())
|
||||
.filter(
|
||||
(item) =>
|
||||
item.issPageValue === issPageValue &&
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
import router from "@/router"
|
||||
|
||||
|
||||
describe("router getNavigationMap", () => {
|
||||
test("should return correct destinationUrl for welcome-page and CLICKED_TEST scenario", function() {
|
||||
const currentRoute = { query: {issPage: "welcome-page"}};
|
||||
expect(router.getNavigationMap("CLICKED_TEST", currentRoute)).toEqual({"destinationUrl": "https://www.google.com", "scenario": "CLICKED_TEST"});
|
||||
});
|
||||
|
||||
test("should return undefined with bad issPage", function() {
|
||||
const currentRoute = { query: {issPage: "badRoute"}};
|
||||
expect(router.getNavigationMap("CLICKED_TEST", currentRoute)).toBeUndefined;
|
||||
});
|
||||
|
||||
test("should return undefined with missing scenario", function() {
|
||||
const currentRoute = { query: {issPage: "welcome-page"}};
|
||||
expect(router.getNavigationMap("MISSING_SCENARIO", currentRoute)).toBeUndefined;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -2,7 +2,7 @@ import { issPageValues } from "@/router/router-constants/issPage-values";
|
|||
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
|
||||
|
||||
// Get store from router/index.js instead of importing it here to get updated values
|
||||
const routingTable = function() {
|
||||
const routingTable = function(store) {
|
||||
return [
|
||||
{
|
||||
issPageValue: issPageValues.VEHICLE_YEAR,
|
||||
|
|
|
|||
Loading…
Reference in a new issue