Reverting Commit #386 from linting9 branch.
This commit is contained in:
parent
26857eaad3
commit
bc5d9842d0
186 changed files with 4185 additions and 5921 deletions
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = {
|
||||
presets: ['@vue/cli-plugin-babel/preset']
|
||||
presets: ["@vue/cli-plugin-babel/preset"],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,26 +1,23 @@
|
|||
module.exports = {
|
||||
verbose: true,
|
||||
coverageReporters: ['html', 'text', 'cobertura'],
|
||||
reporters: ['default', 'jest-junit'],
|
||||
testResultsProcessor: 'jest-junit',
|
||||
preset: '@vue/cli-plugin-unit-jest',
|
||||
transform: { '^.+\\.vue$': '@vue/vue3-jest' },
|
||||
moduleFileExtensions: ['js', 'vue'],
|
||||
moduleNameMapper: {
|
||||
axios: 'axios/dist/browser/axios.cjs'
|
||||
},
|
||||
collectCoverageFrom: [
|
||||
'src/**/*.{js,vue}',
|
||||
'!src/main.js',
|
||||
'!src/constants/*.js',
|
||||
'!src/router/**/*.js',
|
||||
'!src/helpers/unit-test-helper.js'
|
||||
verbose: true,
|
||||
coverageReporters: ["html", "text", "cobertura"],
|
||||
reporters: ["default", "jest-junit"],
|
||||
testResultsProcessor: "jest-junit",
|
||||
preset: "@vue/cli-plugin-unit-jest",
|
||||
transform: { "^.+\\.vue$": "@vue/vue3-jest" },
|
||||
moduleFileExtensions: ["js", "vue"],
|
||||
collectCoverageFrom: [
|
||||
"src/**/*.{js,vue}",
|
||||
"!src/main.js",
|
||||
"!src/constants/*.js",
|
||||
"!src/router/**/*.js",
|
||||
"!src/helpers/unit-test-helper.js"
|
||||
// END
|
||||
], // ! means exclude from coverage.
|
||||
testMatch: ['**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)'],
|
||||
coverageThreshold: {
|
||||
// global: {
|
||||
// statements: 80,
|
||||
// },
|
||||
}
|
||||
], // ! means exclude from coverage.
|
||||
testMatch: ["**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"],
|
||||
coverageThreshold: {
|
||||
// global: {
|
||||
// statements: 80,
|
||||
// },
|
||||
},
|
||||
};
|
||||
|
|
|
|||
6532
package-lock.json
generated
6532
package-lock.json
generated
File diff suppressed because it is too large
Load diff
11
package.json
11
package.json
|
|
@ -12,18 +12,16 @@
|
|||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"test:unit": "vue-cli-service test:unit --coverage --ci",
|
||||
"test:unit:lite": "vue-cli-service test:unit --ci",
|
||||
"test:pc": "vue-cli-service test:unit service-package-radio.spec.js"
|
||||
"test:unit:lite": "vue-cli-service test:unit --ci"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.4.0",
|
||||
"axios-retry": "^3.5.0",
|
||||
"axios": "^0.27.2",
|
||||
"bootstrap": "^5.2.3",
|
||||
"maska": "^1.5.0",
|
||||
"pinia": "^2.1.3",
|
||||
"pinia": "^2.0.22",
|
||||
"pinia-plugin-persistedstate": "^2.2.0",
|
||||
"vee-validate": "^4.7.0",
|
||||
"vue": "^3.2.47",
|
||||
"vue": "^3.2.13",
|
||||
"vue-plugin-load-script": "^2.1.0",
|
||||
"vue-router": "4.1.3"
|
||||
},
|
||||
|
|
@ -43,7 +41,6 @@
|
|||
"eslint-config-airbnb-base": "15.0.0",
|
||||
"eslint-import-resolver-alias": "1.1.2",
|
||||
"eslint-plugin-import": "2.26.0",
|
||||
"eslint-plugin-jsdoc": "^46.4.3",
|
||||
"eslint-plugin-vue": "^9.15.1",
|
||||
"jest": "^27.0.5",
|
||||
"jest-junit": "^13.0.0",
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
<template>
|
||||
<router-view v-slot="{ Component }">
|
||||
<transition
|
||||
:duration="{ enter: 200, leave: 200 }"
|
||||
name="route-fade"
|
||||
mode="out-in">
|
||||
<transition :duration="{ enter: 200, leave: 200 }" name="route-fade" mode="out-in">
|
||||
<!-- The above durations should be kept in sync with the global css class "fade-on-route-transition" -->
|
||||
<component :is="Component" />
|
||||
</transition>
|
||||
|
|
|
|||
|
|
@ -1,36 +1,36 @@
|
|||
const analyticsPageEvents = Object.freeze({
|
||||
const analyticsPageEvents = {
|
||||
ENTRY: 'ENTRY',
|
||||
EVENT: 'EVENT'
|
||||
});
|
||||
};
|
||||
|
||||
// GA Constants
|
||||
const GaEvents = Object.freeze({
|
||||
const GaEvents = {
|
||||
GENERIC_EVENT: 'event',
|
||||
PAGE_VIEW_EVENT: 'logPageview'
|
||||
});
|
||||
};
|
||||
|
||||
const GaCategories = Object.freeze({
|
||||
const GaCategories = {
|
||||
API_RESPONSE: 'Api_Response',
|
||||
EVOX: 'Evox'
|
||||
});
|
||||
};
|
||||
|
||||
const GaActions = Object.freeze({
|
||||
const GaActions = {
|
||||
RESULT: 'Result',
|
||||
CLICKED: 'Clicked',
|
||||
VIF: 'vif',
|
||||
SUBMITTED: 'Submitted'
|
||||
});
|
||||
};
|
||||
|
||||
const GaLabels = Object.freeze({
|
||||
const GaLabels = {
|
||||
SUCCESS: 'Success',
|
||||
ERROR: 'Error',
|
||||
LICENSE_PLATE_LOOKUP: 'License_Plate_Look_Up',
|
||||
VIN_LOOKUP: 'Vin_Look_Up',
|
||||
ADDRESS_LOOKUP: 'Address_Look_up'
|
||||
});
|
||||
};
|
||||
|
||||
const ValueToLogTypes = Object.freeze({
|
||||
const ValueToLogTypes = {
|
||||
LAST_5: 'last_5'
|
||||
});
|
||||
};
|
||||
|
||||
export { analyticsPageEvents, GaCategories, GaActions, GaLabels, GaEvents, ValueToLogTypes };
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const applicationConfig = Object.freeze({
|
||||
const applicationConfig = {
|
||||
CURRENT_ENVIRONMENT: process.env.VUE_APP_CURRENT_ENVIRONMENT, // "Localhost", "Dev", "QA", and "Prod"
|
||||
CONSUMER_CF_DISTRO: process.env.VUE_APP_CONSUMER_CF_DISTRO,
|
||||
ANALYTICS_SESSION_TIMEOUT_MINUTES: 30,
|
||||
|
|
@ -12,6 +12,6 @@ const applicationConfig = Object.freeze({
|
|||
GOOGLE_PLACES_API_KEY: process.env.VUE_APP_GOOGLE_PLACES_API_KEY,
|
||||
ISS_DEV_CMS_DOMAIN: 'https://digitalisscms.dev.safelite.io',
|
||||
CASH_PARENT_ACCOUNT_NUMBER: 167132
|
||||
});
|
||||
};
|
||||
|
||||
export default applicationConfig;
|
||||
export { applicationConfig };
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
import applicationConfig from '@/constants/application-config.js';
|
||||
import { applicationConfig } from '@/constants/application-config.js';
|
||||
|
||||
const cookieNames = Object.freeze({
|
||||
const cookieNames = {
|
||||
ISS_SESSION_INFO: `ISSSessionInfo-${applicationConfig.CURRENT_ENVIRONMENT}`,
|
||||
|
||||
// Existing Safelite.com cookies
|
||||
DXDEV: 'dxdev',
|
||||
SESSION_ID: 'sid',
|
||||
SESSION_KEY: 'skey'
|
||||
});
|
||||
};
|
||||
|
||||
export default cookieNames;
|
||||
export { cookieNames };
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const coverageStatuses = Object.freeze({
|
||||
const coverageStatuses = {
|
||||
PENDING: 'Pending',
|
||||
NO_COMP: 'No Comp',
|
||||
VERIFIED: 'Verified'
|
||||
});
|
||||
};
|
||||
|
||||
export default coverageStatuses;
|
||||
export { coverageStatuses };
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
const damageLocationsCms = Object.freeze({
|
||||
const damageLocationsCms = {
|
||||
WINDSHIELD: 'WINDSHIELD',
|
||||
SIDEDOOR: 'SIDEDOOR',
|
||||
REARWINDOW: 'REARWINDOW',
|
||||
DRIVERSIDE: 'DRIVERSIDE',
|
||||
PASSENGERSIDE: 'PASSENGERSIDE'
|
||||
});
|
||||
};
|
||||
|
||||
export default damageLocationsCms;
|
||||
export { damageLocationsCms };
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const damageLocationsSelected = Object.freeze({
|
||||
const damageLocationsSelected = {
|
||||
WINDSHIELD: 'Windshield',
|
||||
SIDEDOOR: 'SideDoor',
|
||||
REARWINDOW: 'RearWindow',
|
||||
|
|
@ -16,6 +16,6 @@ const damageLocationsSelected = Object.freeze({
|
|||
PASSENGERSIDE: 'PassengerSide',
|
||||
STATIONARY: 'Stationary',
|
||||
SLIDER: 'Slider'
|
||||
});
|
||||
};
|
||||
|
||||
export default damageLocationsSelected;
|
||||
export { damageLocationsSelected };
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
const dynamicStrings = Object.freeze({
|
||||
const dynamicStrings = {
|
||||
GLOBAL_STATE: 'globalState',
|
||||
CUSTOM: 'custom',
|
||||
ROUTER_LINK: 'routerLink:',
|
||||
MODAL_LINK: 'modalLink',
|
||||
TEXT_LINK: 'textLink',
|
||||
EXTERNAL_LINK: 'externalLink'
|
||||
});
|
||||
};
|
||||
|
||||
export default dynamicStrings;
|
||||
export { dynamicStrings };
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
// Example: {custom:glassName}, each key in the array is the value after custom:, like 'glassname'
|
||||
// Please use lowercase only so that we don't have to worry about case sensitivity.
|
||||
|
||||
const customMappings = Object.freeze({
|
||||
const customMappings = {
|
||||
formattedglassname: [
|
||||
{ key: 'Windshield Single', transformedValue: 'windshield' },
|
||||
{ key: 'Windshield Driver', transformedValue: 'driver side split windshield' },
|
||||
|
|
@ -20,12 +20,12 @@ const customMappings = Object.freeze({
|
|||
{ key: 'Passenger Quarter', transformedValue: 'passenger side quarter panel' },
|
||||
{ key: 'Passenger SlideDoor', transformedValue: 'passenger side sliding door' }
|
||||
]
|
||||
});
|
||||
};
|
||||
|
||||
// Gets an instance of a string where the dynamic portion of the text {custom:KeyName}
|
||||
// is replaced by a value from the above map.
|
||||
// If the value isn't found, return the original dynamic string without replacement
|
||||
const getCustomTransformValue = (dynamicString, key) => {
|
||||
export function getCustomTransformValue(dynamicString, key) {
|
||||
// Get array key from the dynamic string
|
||||
const regexExp = /{(.*?):(.*?)}/g;
|
||||
const matches = [...dynamicString.matchAll(regexExp)];
|
||||
|
|
@ -53,6 +53,4 @@ const getCustomTransformValue = (dynamicString, key) => {
|
|||
const finalString = dynamicString.replace(`{custom:${arrayKey}}`, mapObject.transformedValue);
|
||||
|
||||
return finalString;
|
||||
};
|
||||
|
||||
export default getCustomTransformValue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const endorsementOptions = Object.freeze({
|
||||
const endorsementOptions = {
|
||||
EDUCATOR: 'Educator',
|
||||
OEM_APPROVED: 'OEM Approved',
|
||||
FULL_GLASS: 'Full Glass Coverage',
|
||||
PARKING_GUARD: 'Parking Guard',
|
||||
REPAIR_WAIVED: 'Repair Waived'
|
||||
});
|
||||
};
|
||||
|
||||
export default endorsementOptions;
|
||||
export { endorsementOptions };
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
const endpoints = Object.freeze({
|
||||
const endpoints = {
|
||||
GetRouteInfo: {
|
||||
url: (applicationAbbreviation) => `/content/api/v1/content/${applicationAbbreviation}/RouteInfo`,
|
||||
method: 'POST'
|
||||
|
|
@ -130,6 +130,6 @@ const endpoints = Object.freeze({
|
|||
url: '/coverage/api/v1/coverage/register-claim',
|
||||
method: 'POST'
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export default endpoints;
|
||||
export { endpoints };
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const errorMessages = Object.freeze({
|
||||
const errorMessages = {
|
||||
DAMAGE_LOCATION_REQUIRED: 'Please select damage location',
|
||||
DAMAGE_SIDE_REQUIRED: 'Please select vehicle side',
|
||||
DRIVER_SIDE_OPTIONS_REQUIRED: 'Please select window',
|
||||
|
|
@ -21,7 +21,6 @@ const errorMessages = Object.freeze({
|
|||
SERVICE_ZIP_REQUIRED: 'Please enter your service ZIP',
|
||||
SERVICE_ZIP_FORMAT: 'Please enter a valid service ZIP',
|
||||
VIN_REQUIRED: 'Please enter your VIN',
|
||||
// eslint-disable-next-line max-len
|
||||
VIN_FORMAT: 'Invalid VIN. Please make sure that you entered the correct 17-digit, alpha-numeric number. VINs do not contain the letters I, O, or Q',
|
||||
OPTION_REQUIRED: 'Please select an option',
|
||||
VEHICLE_REQUIRED: 'Please select a vehicle',
|
||||
|
|
@ -45,6 +44,6 @@ const errorMessages = Object.freeze({
|
|||
MODEL_REQUIRED: 'Please select your vehicle model',
|
||||
STYLE_REQUIRED: 'Please select your vehicle style'
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
export default errorMessages;
|
||||
export { errorMessages };
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
const globalEvents = Object.freeze({
|
||||
const globalEvents = {
|
||||
Categories: {
|
||||
GLOBAL_ALERT: 'GLOBAL_ALERT'
|
||||
},
|
||||
SubCategories: {
|
||||
PAGE_NOT_FOUND: 'PAGE_NOT_FOUND'
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const globalEventTypes = Object.freeze({
|
||||
const globalEventTypes = {
|
||||
Success: 'alert-success',
|
||||
Warning: 'alert-warning',
|
||||
Info: 'alert-info',
|
||||
Danger: 'alert-danger'
|
||||
});
|
||||
};
|
||||
|
||||
export { globalEvents, globalEventTypes };
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
const experimentUniverses = Object.freeze({
|
||||
const experimentUniverses = {
|
||||
ISS_FUNNEL: 'ISSFunnel'
|
||||
});
|
||||
};
|
||||
|
||||
const experimentSettings = Object.freeze({
|
||||
const experimentSettings = {
|
||||
GOOGLE_CUSTOM_DIMENSION_INDEX: 'Google Custom Dimension Index'
|
||||
});
|
||||
};
|
||||
|
||||
const experimentTriggers = Object.freeze({
|
||||
const experimentTriggers = {
|
||||
SITE_ENTRY: 'SiteEntry',
|
||||
PAGE_ENTRY: 'PageEntry'
|
||||
});
|
||||
};
|
||||
|
||||
export { experimentUniverses, experimentSettings, experimentTriggers };
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
/**
|
||||
* @summary Contains all the globally defined rules.
|
||||
*/
|
||||
const globalRules = Object.freeze({
|
||||
const globalRules = {
|
||||
POLICYHOLDER_FIRST_NAME_REQUIRED: 'policyholder-first-name-required',
|
||||
POLICYHOLDER_LAST_NAME_REQUIRED: 'policyholder-last-name-required',
|
||||
FIRST_NAME_REQUIRED: 'first-name-required',
|
||||
|
|
@ -17,6 +17,6 @@ const globalRules = Object.freeze({
|
|||
EMAIL_ADDRESS_FORMAT: 'email-address-format',
|
||||
PHONE_NUMBER_FORMAT: 'phone-number-format',
|
||||
OPTION_REQUIRED: 'option-required'
|
||||
});
|
||||
};
|
||||
|
||||
export default globalRules;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
const headerKeys = Object.freeze({
|
||||
export const headerKeys = {
|
||||
EXPERIMENT: 'X-Experiment-Data'
|
||||
});
|
||||
|
||||
export default headerKeys;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
// used until real services are available
|
||||
|
||||
const endpoints = Object.freeze({
|
||||
const endpoints = {
|
||||
GetRouteInfo: {
|
||||
url: 'https://mockey.qa.sagaws.net/service/ISS/Content/RouteInfo',
|
||||
method: 'GET'
|
||||
}
|
||||
});
|
||||
|
||||
export default endpoints;
|
||||
};
|
||||
|
||||
export { endpoints };
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
const partTypeStrings = Object.freeze({
|
||||
const partTypeStrings = {
|
||||
FRONT_WIPER: 'FRONT WIPER',
|
||||
REAR_WIPER: 'REAR WIPER',
|
||||
RAIN_DEFENSE: 'RAIN DEFENSE',
|
||||
RECALIBRATION: 'RECALIBRATION'
|
||||
});
|
||||
};
|
||||
|
||||
export default partTypeStrings;
|
||||
export { partTypeStrings };
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
const queryStrings = Object.freeze({
|
||||
const queryStrings = {
|
||||
ISS_PAGE: 'issPage'
|
||||
});
|
||||
};
|
||||
|
||||
export default queryStrings;
|
||||
export { queryStrings };
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
const states = Object.freeze({
|
||||
export const states = {
|
||||
AL: 'Alabama',
|
||||
AK: 'Alaska',
|
||||
AZ: 'Arizona',
|
||||
|
|
@ -50,6 +50,4 @@ const states = Object.freeze({
|
|||
WV: 'West Virginia',
|
||||
WI: 'Wisconsin',
|
||||
WY: 'Wyoming'
|
||||
});
|
||||
|
||||
export default states;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// TintMap with array keys by location, lowercase to avoid as much string mismatching as possible.
|
||||
// Src assumes you have a @/assets/img/tints/, making the final value @/assets/img/tints/{Src} in the markup.
|
||||
// See vehicle-parts for implementation example.
|
||||
const tintMap = Object.freeze({
|
||||
const tintMap = {
|
||||
other: [
|
||||
// Blue Shade
|
||||
{ name: 'blue tint, blue shade', src: 'Glass-BlueShade-BlueTint.svg' },
|
||||
|
|
@ -71,15 +71,14 @@ const tintMap = Object.freeze({
|
|||
// No shade or tint
|
||||
{ name: 'clear', src: 'Windshield-NoShade-NoTint.svg' }
|
||||
]
|
||||
});
|
||||
};
|
||||
|
||||
// Gets the tint image source string given the glass location, and the tint description (like 'Green Tint')
|
||||
// Use lowered strings here to try to avoid mismatch. Returns an empty string if array key doesn't exist.
|
||||
// Returns undefined if no items are found.
|
||||
const getTintImage = (glassLocation, colorString) => {
|
||||
export function getTintImage(glassLocation, colorString) {
|
||||
// Windshield glass has special images, all other glass uses the same though.
|
||||
if (glassLocation.toLowerCase() !== 'windshield') {
|
||||
// TODO: Fix assignment to parm
|
||||
glassLocation = 'other';
|
||||
}
|
||||
|
||||
|
|
@ -91,6 +90,4 @@ const getTintImage = (glassLocation, colorString) => {
|
|||
.find((item) => item.name.toLowerCase() === colorString.toLowerCase());
|
||||
|
||||
return tintImageSource;
|
||||
};
|
||||
|
||||
export default getTintImage;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const vehicleCategories = Object.freeze({
|
||||
const vehicleCategories = {
|
||||
CAR: 'CAR',
|
||||
TRUCK: 'TRUCK',
|
||||
VAN: 'VAN',
|
||||
|
|
@ -6,6 +6,6 @@ const vehicleCategories = Object.freeze({
|
|||
SUV: 'SUV',
|
||||
MOTORHOME: 'MOTOR HOME',
|
||||
SEMI: 'SEMI'
|
||||
});
|
||||
};
|
||||
|
||||
export default vehicleCategories;
|
||||
export { vehicleCategories };
|
||||
|
|
@ -2,4 +2,4 @@ const vehicleSelectionOptions = Object.freeze({
|
|||
VEHICLE_NOT_LISTED: 'Vehicle not listed'
|
||||
});
|
||||
|
||||
export default vehicleSelectionOptions;
|
||||
export { vehicleSelectionOptions };
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@ const vinLookupMethodSelections = Object.freeze({
|
|||
HOMEADDRESS: 'HomeAddress'
|
||||
});
|
||||
|
||||
export default vinLookupMethodSelections;
|
||||
export { vinLookupMethodSelections };
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import {
|
|||
handleButtonComponentFocus,
|
||||
handleInputComponentBlur
|
||||
} from '@/helpers/button-question-focus-helper';
|
||||
import inputButtonProps from '@/digital-components/base-input-button/button-functionality-props';
|
||||
import { inputButtonProps } from '@/digital-components/base-input-button/button-functionality-props';
|
||||
|
||||
export default {
|
||||
name: 'base-input-button',
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const inputButtonProps = Object.seal({
|
||||
export const inputButtonProps = {
|
||||
value: {
|
||||
type: [String, Number],
|
||||
required: true
|
||||
|
|
@ -35,6 +35,4 @@ const inputButtonProps = Object.seal({
|
|||
default: false
|
||||
},
|
||||
suppressError: Boolean
|
||||
});
|
||||
|
||||
export default inputButtonProps;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,15 +2,6 @@ import { shallowMount } from '@vue/test-utils';
|
|||
import buttonQuestion from '@/digital-components/button-question/button-question';
|
||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||
|
||||
function setupMocks(mountOptionsMockData = {}) {
|
||||
const defaultMountOptions = { route: { query: { issPage: 'page-name' } } };
|
||||
const baseMountOptions
|
||||
= getMountOptions(Object.assign(defaultMountOptions, mountOptionsMockData));
|
||||
const allMountOptions = Object.assign(defaultMountOptions, baseMountOptions);
|
||||
|
||||
return allMountOptions;
|
||||
}
|
||||
|
||||
describe('buttonQuestion.vue', () => {
|
||||
it('Fieldset classes should contain row if button type is listCard', () => {
|
||||
// Act
|
||||
|
|
@ -310,7 +301,6 @@ describe('buttonQuestion.vue', () => {
|
|||
expect(buttonsInfo[1].buttonLabelSubCopy).toEqual('buttonLabelSubCopy 2');
|
||||
});
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
test('answers have SubText properties, no buttonLabelSubCopy properties => buttonsInfo buttonLabelSubCopy properties are correct', () => {
|
||||
// Arrange
|
||||
const wrapper = shallowMount(buttonQuestion,
|
||||
|
|
@ -404,7 +394,6 @@ describe('buttonQuestion.vue', () => {
|
|||
expect(buttonsInfo[1].buttonImage).toEqual('buttonImage 2');
|
||||
});
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
test('answers have AnswerImageUrl properties, no buttonImage properties => buttonsInfo buttonImage properties are correct', () => {
|
||||
// Arrange
|
||||
const wrapper = shallowMount(buttonQuestion,
|
||||
|
|
@ -1020,3 +1009,12 @@ describe('buttonQuestion.vue', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
function setupMocks(mountOptionsMockData = {}) {
|
||||
const defaultMountOptions = { route: { query: { issPage: 'page-name' } } };
|
||||
const baseMountOptions
|
||||
= getMountOptions(Object.assign(defaultMountOptions, mountOptionsMockData));
|
||||
const allMountOptions = Object.assign(defaultMountOptions, baseMountOptions);
|
||||
|
||||
return allMountOptions;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { shallowMount } from '@vue/test-utils';
|
||||
import dropdownQuestion from '@/digital-components/dropdown-question/dropdown-question';
|
||||
import dropdownQuestion from './dropdown-question';
|
||||
|
||||
// Mock CMS content
|
||||
const questionText = 'Question Text';
|
||||
|
|
@ -9,10 +9,9 @@ const mockMixin = {
|
|||
}
|
||||
};
|
||||
|
||||
// TODO: Tests need fixup
|
||||
// TODO: Remove the following from dropdown-question.vue -> :class="(errors && errors.length) || hasError ? 'has-error' : ''"
|
||||
// It is not being used.
|
||||
describe.skip('dropdownQuestion.vue', () => {
|
||||
describe('dropdownQuestion.vue', () => {
|
||||
it('Should render a select input', async () => {
|
||||
// Arrange
|
||||
const wrapper = shallowMount(dropdownQuestion, {
|
||||
|
|
@ -47,7 +46,6 @@ describe.skip('dropdownQuestion.vue', () => {
|
|||
expect(label.text()).toContain(questionText);
|
||||
});
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
it("Should render the 'questionText' data value with '⁠' after the first character of each word in the label text when disableAutoFill is true.", async () => {
|
||||
// Arrange
|
||||
const wrapper = shallowMount(dropdownQuestion, {
|
||||
|
|
@ -156,6 +154,6 @@ describe.skip('dropdownQuestion.vue', () => {
|
|||
wrapper.vm.$options.watch.selectedOption.call(wrapper.vm, 1);
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.handleChange).toHaveBeenCalled();
|
||||
expect(wrapper.vm.handleChange).toHaveBeenCalled;
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
v-if="placeHolderText"
|
||||
value=""
|
||||
selected>
|
||||
{{ placeHolderText }}
|
||||
{{ placeHolderText }}
|
||||
</option>
|
||||
<option
|
||||
v-for="(value, name, index) in options"
|
||||
|
|
@ -79,10 +79,9 @@ export default {
|
|||
initialValue
|
||||
};
|
||||
|
||||
const { errorMessage, handleBlur, handleChange, meta, errors }
|
||||
= useField(props.inputId,
|
||||
props.validationRules,
|
||||
fieldOptions);
|
||||
const { errorMessage, handleBlur, handleChange, meta, errors } = useField(props.inputId,
|
||||
props.validationRules,
|
||||
fieldOptions);
|
||||
|
||||
return {
|
||||
errorMessage,
|
||||
|
|
@ -112,12 +111,12 @@ export default {
|
|||
const words = this.questionText.toString().split(/[ ]+/);
|
||||
words.forEach((word) => {
|
||||
const position = 1;
|
||||
const newWord = [
|
||||
word = [
|
||||
word.toString().slice(0, position),
|
||||
noBreakChar,
|
||||
word.toString().slice(position)
|
||||
].join('');
|
||||
questionText += `${newWord} `;
|
||||
questionText += `${word} `;
|
||||
});
|
||||
|
||||
questionText = questionText.trimEnd();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { shallowMount } from '@vue/test-utils';
|
|||
import crypto from 'crypto';
|
||||
import { useForm } from 'vee-validate';
|
||||
import { Modal } from 'bootstrap';
|
||||
import modal from '@/digital-components/modal/modal';
|
||||
import modal from './modal';
|
||||
|
||||
jest.mock('vee-validate', () => ({
|
||||
useForm: jest.fn()
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
loaderColor="white"
|
||||
:buttonText="footerButtonText"
|
||||
:class="(isButtonDisabled || isFooterButtonDisabled) && 'form-test-invalid'"
|
||||
@clickEvent="validateAndEmit" />
|
||||
@click-event="validateAndEmit" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -3,39 +3,6 @@ import questionChain from '@/digital-components/question-chain/question-chain';
|
|||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||
import { nextTick } from 'vue';
|
||||
|
||||
function setupMocks({
|
||||
questionDataProp = [
|
||||
{
|
||||
questionSequence: 1,
|
||||
questionText: 'Does only your center sliding piece need to be replaced?',
|
||||
answers: [
|
||||
{
|
||||
answerResult: 'DB09410',
|
||||
answerText: 'Yes',
|
||||
nextQuestionSequence: null
|
||||
},
|
||||
{
|
||||
answerResult: 'DB10840',
|
||||
answerText: 'No',
|
||||
nextQuestionSequence: null
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}) {
|
||||
Element.prototype.scrollIntoView = jest.fn();
|
||||
|
||||
const mountOptions = getMountOptions({});
|
||||
mountOptions.propsData = {
|
||||
questionData: questionDataProp
|
||||
};
|
||||
mountOptions.attachTo = document.body;
|
||||
|
||||
const wrapper = shallowMount(questionChain, mountOptions);
|
||||
|
||||
return { wrapper };
|
||||
}
|
||||
|
||||
describe('Question Chain component', () => {
|
||||
describe('on create...', () => {
|
||||
test('Should populate questions data array', async () => {
|
||||
|
|
@ -238,7 +205,7 @@ describe('Question Chain component', () => {
|
|||
wrapper.vm.getQuestionChainAnswerIfComplete(testReturnedAnswer);
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.questions[1].answerSelected).toBeUndefined();
|
||||
expect(wrapper.vm.questions[1].answerSelected).toBeUndefined;
|
||||
});
|
||||
|
||||
test('should return false if returnedAnswer is a nextQuestion (not a final answer)', async () => {
|
||||
|
|
@ -312,3 +279,36 @@ describe('Question Chain component', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
function setupMocks({
|
||||
questionDataProp = [
|
||||
{
|
||||
questionSequence: 1,
|
||||
questionText: 'Does only your center sliding piece need to be replaced?',
|
||||
answers: [
|
||||
{
|
||||
answerResult: 'DB09410',
|
||||
answerText: 'Yes',
|
||||
nextQuestionSequence: null
|
||||
},
|
||||
{
|
||||
answerResult: 'DB10840',
|
||||
answerText: 'No',
|
||||
nextQuestionSequence: null
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}) {
|
||||
Element.prototype.scrollIntoView = jest.fn();
|
||||
|
||||
const mountOptions = getMountOptions({});
|
||||
mountOptions.propsData = {
|
||||
questionData: questionDataProp
|
||||
};
|
||||
mountOptions.attachTo = document.body;
|
||||
|
||||
const wrapper = shallowMount(questionChain, mountOptions);
|
||||
|
||||
return { wrapper };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ export default {
|
|||
returnedAnswer example format:
|
||||
"1|answer|DD11132|Yes"
|
||||
*/
|
||||
// TODO: Assignment to parm
|
||||
|
||||
question.answerSelected = returnedAnswer;
|
||||
const isQuestionChainComplete = this.getQuestionChainAnswerIfComplete(returnedAnswer);
|
||||
|
||||
|
|
@ -123,7 +123,6 @@ export default {
|
|||
|
||||
this.questions.forEach((q) => {
|
||||
// find this question and mark it as "answered" by populating answerSelected
|
||||
// TODO: Assignment to parms
|
||||
if (q.questionSequence === questionNum) {
|
||||
q.answerSelected = returnedAnswer;
|
||||
q.answerNumber = questionNum;
|
||||
|
|
@ -132,7 +131,6 @@ export default {
|
|||
// remove all answers AFTER this question...
|
||||
// (needed in case user is changing previously answered questions)
|
||||
if (q.questionSequence > questionNum) {
|
||||
// TODO: Assignment to parms
|
||||
delete q.answerSelected;
|
||||
}
|
||||
if (q.answerSelected) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { shallowMount } from '@vue/test-utils';
|
||||
import TextBlock from '@/digital-components/text-block/text-block';
|
||||
import TextBlock from './text-block';
|
||||
|
||||
const mockCmsContent = {
|
||||
Text: 'Sample text here.'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { shallowMount } from '@vue/test-utils';
|
||||
import textboxQuestion from '@/digital-components/textbox-question/textbox-question';
|
||||
import textboxQuestion from './textbox-question';
|
||||
|
||||
// Mock CMS content
|
||||
const questionText = 'Question Text';
|
||||
|
|
@ -10,8 +10,7 @@ const mockMixin = {
|
|||
};
|
||||
const maska = jest.fn();
|
||||
|
||||
// Tests need fixed up
|
||||
describe.skip('textboxQuestion.vue', () => {
|
||||
describe('textboxQuestion.vue', () => {
|
||||
it('Should render a text input', async () => {
|
||||
// Arrange
|
||||
const wrapper = shallowMount(textboxQuestion, {
|
||||
|
|
@ -152,6 +151,6 @@ describe.skip('textboxQuestion.vue', () => {
|
|||
wrapper.vm.$options.watch.value.call(wrapper.vm, 'bar');
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.handleChange).toHaveBeenCalled();
|
||||
expect(wrapper.vm.handleChange).toHaveBeenCalled;
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -164,12 +164,12 @@ export default {
|
|||
const words = this.questionText.toString().split(/[ ]+/);
|
||||
words.forEach((word) => {
|
||||
const position = 1;
|
||||
const newWord = [
|
||||
word = [
|
||||
word.toString().slice(0, position),
|
||||
noBreakChar,
|
||||
word.toString().slice(position)
|
||||
].join('');
|
||||
questionText += `${newWord} `;
|
||||
questionText += `${word} `;
|
||||
});
|
||||
|
||||
questionText = questionText.trimEnd();
|
||||
|
|
|
|||
|
|
@ -2,47 +2,50 @@ import axios from 'axios';
|
|||
import analyticsMixIn from '@/mixins/analytics-mixin.js';
|
||||
import { useMainStore } from '@/store';
|
||||
|
||||
import applicationConfig from '@/constants/application-config.js';
|
||||
import { applicationConfig } from '@/constants/application-config.js';
|
||||
import { GaCategories, GaActions, GaLabels } from '@/constants/analytics';
|
||||
import headerKeys from '@/constants/header-keys';
|
||||
import { headerKeys } from '@/constants/header-keys';
|
||||
|
||||
export default {
|
||||
callHttpClient({ method, endpoint, payload, logApiCall = true }) {
|
||||
callHttpClient({ method, endpoint, payload, logApiCall = true}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const store = useMainStore();
|
||||
const cfDistroUrl = applicationConfig.CONSUMER_CF_DISTRO;
|
||||
const payloadAndAnalyticsData = { ...payload, AppName: 'SelfService' };
|
||||
const payloadAndAnalyticsData = Object.assign({}, payload, { AppName: 'SelfService' });
|
||||
const headers = {
|
||||
[headerKeys.EXPERIMENT]: JSON.stringify(store.experimentSettings)
|
||||
};
|
||||
|
||||
axios({
|
||||
method,
|
||||
method: method,
|
||||
url: cfDistroUrl + endpoint,
|
||||
data: payloadAndAnalyticsData,
|
||||
crossDomain: true,
|
||||
responseType: 'json',
|
||||
headers
|
||||
headers: headers,
|
||||
})
|
||||
.then((response) => {
|
||||
if (logApiCall) {
|
||||
analyticsMixIn.methods.pushEventToGA(GaCategories.API_RESPONSE,
|
||||
analyticsMixIn.methods.pushEventToGA(
|
||||
GaCategories.API_RESPONSE,
|
||||
GaActions.RESULT,
|
||||
`${GaLabels.SUCCESS}_${endpoint}`,
|
||||
true);
|
||||
true
|
||||
);
|
||||
}
|
||||
return resolve(response);
|
||||
},
|
||||
(error) => {
|
||||
error => {
|
||||
console.error(error);
|
||||
|
||||
// implement if analytics service is down
|
||||
if (endpoint.includes('analytics')) {
|
||||
return resolve({ data: '' });
|
||||
return resolve({data: ''});
|
||||
}
|
||||
|
||||
return reject(error.response);
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
|
|
@ -50,16 +53,19 @@ export default {
|
|||
async mockCallHttpClient(method, endpoint) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios({
|
||||
method,
|
||||
method: method,
|
||||
url: endpoint,
|
||||
crossDomain: true,
|
||||
responseType: {}
|
||||
})
|
||||
.then((response) => resolve(response),
|
||||
(error) => {
|
||||
console.error(error);
|
||||
return reject(error.response);
|
||||
});
|
||||
.then((response) => {
|
||||
return resolve(response);
|
||||
},
|
||||
error => {
|
||||
console.error(error);
|
||||
return reject(error.response);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,6 +7,38 @@ import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
|||
jest.mock('axios');
|
||||
jest.mock('@/mixins/analytics-mixin');
|
||||
|
||||
it('Global Methods - Call Http Client - Should Resolve Promise', () => {
|
||||
// Arrange
|
||||
const endpoint = 'https://mock.safelite.com';
|
||||
const httpArgs = setupMocksForHttpClient({ endpoint: endpoint });
|
||||
|
||||
// Act
|
||||
globalMethods.callHttpClient(httpArgs).then((response) => {
|
||||
// Assert
|
||||
expect(axios.mock.calls[0][0].url).toContain(endpoint);
|
||||
expect(response.data.message).toContain('Success');
|
||||
expect(response.status).toEqual(200);
|
||||
});
|
||||
});
|
||||
|
||||
it('Global Methods - Call Http Client - Should Reject Promise', () => {
|
||||
// Arrange
|
||||
const endpoint = 'https://mock.safelite.com';
|
||||
const httpArgs = setupMocksForHttpClient({
|
||||
endpoint: endpoint,
|
||||
isError: true
|
||||
});
|
||||
analyticsMixIn.methods.pushEventToGA = jest.fn();
|
||||
|
||||
// Act
|
||||
globalMethods.callHttpClient(httpArgs).catch((err) => {
|
||||
// Assert
|
||||
expect(axios.mock.calls[0][0].url).toContain(endpoint);
|
||||
expect(err.data.message).toContain('Error');
|
||||
expect(err.status).toEqual(500);
|
||||
});
|
||||
});
|
||||
|
||||
function setupMocksForHttpClient({
|
||||
endpoint = null,
|
||||
isError = false,
|
||||
|
|
@ -22,7 +54,7 @@ function setupMocksForHttpClient({
|
|||
status: 200,
|
||||
data: {
|
||||
message: 'Success',
|
||||
additionalData
|
||||
additionalData: additionalData
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -32,7 +64,7 @@ function setupMocksForHttpClient({
|
|||
status: 500,
|
||||
data: {
|
||||
message: 'Error',
|
||||
additionalData
|
||||
additionalData: additionalData
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -45,39 +77,7 @@ function setupMocksForHttpClient({
|
|||
}
|
||||
|
||||
return {
|
||||
endpoint,
|
||||
endpoint: endpoint,
|
||||
logApiCall: true
|
||||
};
|
||||
}
|
||||
|
||||
it('Global Methods - Call Http Client - Should Resolve Promise', () => {
|
||||
// Arrange
|
||||
const endpoint = 'https://mock.safelite.com';
|
||||
const httpArgs = setupMocksForHttpClient({ endpoint });
|
||||
|
||||
// Act
|
||||
globalMethods.callHttpClient(httpArgs).then((response) => {
|
||||
// Assert
|
||||
expect(axios.mock.calls[0][0].url).toContain(endpoint);
|
||||
expect(response.data.message).toContain('Success');
|
||||
expect(response.status).toEqual(200);
|
||||
});
|
||||
});
|
||||
|
||||
it('Global Methods - Call Http Client - Should Reject Promise', () => {
|
||||
// Arrange
|
||||
const endpoint = 'https://mock.safelite.com';
|
||||
const httpArgs = setupMocksForHttpClient({
|
||||
endpoint,
|
||||
isError: true
|
||||
});
|
||||
analyticsMixIn.methods.pushEventToGA = jest.fn();
|
||||
|
||||
// Act
|
||||
globalMethods.callHttpClient(httpArgs).catch((err) => {
|
||||
// Assert
|
||||
expect(axios.mock.calls[0][0].url).toContain(endpoint);
|
||||
expect(err.data.message).toContain('Error');
|
||||
expect(err.status).toEqual(500);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,15 +1,13 @@
|
|||
import { useMainStore } from '@/store';
|
||||
|
||||
const validateISSClientTag = (clientTag) => {
|
||||
export function validateISSClientTag(clientTag) {
|
||||
const store = useMainStore();
|
||||
|
||||
return store.validateClientTag(clientTag)
|
||||
.then((response) =>
|
||||
// Success
|
||||
// Success
|
||||
response,
|
||||
(error) =>
|
||||
// Error
|
||||
null);
|
||||
};
|
||||
|
||||
export default validateISSClientTag;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,125 @@
|
|||
import dynamicStrings from '@/constants/dynamic-strings';
|
||||
import { dynamicStrings } from '@/constants/dynamic-strings';
|
||||
import { useMainStore } from '@/store';
|
||||
|
||||
function getStoreValueFromString(str) {
|
||||
if (!str) return '';
|
||||
export function fetchCmsContentForPage(issPage) {
|
||||
const store = useMainStore();
|
||||
const { clientName } = store.issConfig;
|
||||
const { accountNumber } = store.issConfig;
|
||||
const clientOverride = (clientName.length > 0 && accountNumber > 0);
|
||||
|
||||
let storeOrStateObject = useMainStore();
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const s of str.split('.')) {
|
||||
if (s === 'getters') continue; // For backward compatibility
|
||||
if (storeOrStateObject[s] != undefined) { // TODO: This is intentional at the moment but needs to be refactored.
|
||||
storeOrStateObject = storeOrStateObject[s];
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
return store.getPageData(issPage)
|
||||
// Get the base/default page first.
|
||||
.then((baseResponse) => {
|
||||
if (!clientOverride) {
|
||||
// Return the base page if there are no client override.
|
||||
return processPageData(baseResponse, null);
|
||||
}
|
||||
// Else get the client override page.
|
||||
const pageName = `${issPage}_${clientName.toLowerCase().replace(/ /g, '')}`;
|
||||
|
||||
return store.getPageData(pageName)
|
||||
.then((clientResponse) =>
|
||||
// Process the client override if it exists.
|
||||
processPageData(baseResponse, clientResponse),
|
||||
(error) => {
|
||||
console.error(error);
|
||||
// Process the just the base if no client override exists.
|
||||
return processPageData(baseResponse, null);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Support method for processing the page data from the CMS call.
|
||||
// widgets = current widget collection used by page.
|
||||
// baseResponse = contains the widgets from the base page.
|
||||
// clientResponse = contains the widgets from the client override page. (null if none)
|
||||
function processPageData(baseResponse, clientResponse) {
|
||||
const pageDataFromCms = {};
|
||||
let widgets = [];
|
||||
|
||||
if (!baseResponse?.data?.Result) {
|
||||
console.error('No result data found'); // Something has gone terribly wrong.
|
||||
return {};
|
||||
}
|
||||
return storeOrStateObject ?? '';
|
||||
if (!clientResponse?.data?.Result) {
|
||||
widgets = baseResponse.data.Result;
|
||||
} else {
|
||||
// Override any base widgets with the client override widgets if found.
|
||||
baseResponse.data.Result.forEach((baseWidget) => {
|
||||
let found = false;
|
||||
clientResponse.data.Result.forEach((clientWidget) => {
|
||||
if (clientWidget.Name === baseWidget.Name) {
|
||||
widgets.push(clientWidget);
|
||||
found = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!found) {
|
||||
widgets.push(baseWidget);
|
||||
}
|
||||
});
|
||||
|
||||
// Add any unique client widgets that does not exist in the current main widgets collection.
|
||||
clientResponse.data.Result.forEach((clientWidget) => {
|
||||
let found = false;
|
||||
widgets.forEach((currentWidget) => {
|
||||
if (clientWidget.Name === currentWidget.Name) {
|
||||
found = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!found) {
|
||||
widgets.push(clientWidget);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
widgets.forEach((widget) => {
|
||||
// Global state value replacement.
|
||||
const widgetWithReplacements = findAndReplaceGlobalStateValues(widget.Model,
|
||||
widget.Name);
|
||||
|
||||
// If we already have this widget, push it on the collection
|
||||
if (widgetWithReplacements.Name in pageDataFromCms) {
|
||||
pageDataFromCms[widgetWithReplacements.Name].push(widgetWithReplacements.Model);
|
||||
return;
|
||||
}
|
||||
|
||||
pageDataFromCms[widgetWithReplacements.Name] = [
|
||||
widgetWithReplacements.Model
|
||||
];
|
||||
});
|
||||
|
||||
Object.keys(pageDataFromCms).forEach((key) => {
|
||||
if (pageDataFromCms[key].length === 1) {
|
||||
pageDataFromCms[key] = pageDataFromCms[key][0];
|
||||
}
|
||||
});
|
||||
|
||||
return pageDataFromCms;
|
||||
}
|
||||
|
||||
// Parent function for processWidgetItemForReplacement. This will loop through the parent
|
||||
// object and pass any objects that need additional processing to the processWidgetItemForReplacement function.
|
||||
function findAndReplaceGlobalStateValues(widgetModel, widgetName) {
|
||||
const objWithReplacements = {
|
||||
Name: widgetName,
|
||||
Model: {}
|
||||
};
|
||||
|
||||
Object.keys(widgetModel).forEach((key) => {
|
||||
const modelWithReplacements = processWidgetItemForReplacement(widgetModel,
|
||||
key);
|
||||
|
||||
objWithReplacements.Model[key] = modelWithReplacements;
|
||||
});
|
||||
|
||||
return objWithReplacements;
|
||||
}
|
||||
|
||||
// This function will process the widget item and replace any global state variables with their values.
|
||||
// This is a recursive function, it will call itself until it runs out of items to iterate on given the object.
|
||||
function processWidgetItemForReplacement(widgetModel, key) {
|
||||
// TODO: widgetModel - Assignment to property or function (several).
|
||||
// If we have a string, and it needs to be replaced.
|
||||
if (typeof widgetModel[key] === 'string') {
|
||||
if (widgetModel[key].includes('{if:')) {
|
||||
|
|
@ -55,122 +154,6 @@ function processWidgetItemForReplacement(widgetModel, key) {
|
|||
return widgetModel[key];
|
||||
}
|
||||
|
||||
// Parent function for processWidgetItemForReplacement. This will loop through the parent
|
||||
// object and pass any objects that need additional processing to the processWidgetItemForReplacement function.
|
||||
function findAndReplaceGlobalStateValues(widgetModel, widgetName) {
|
||||
const objWithReplacements = {
|
||||
Name: widgetName,
|
||||
Model: {}
|
||||
};
|
||||
|
||||
Object.keys(widgetModel).forEach((key) => {
|
||||
const modelWithReplacements = processWidgetItemForReplacement(widgetModel,
|
||||
key);
|
||||
|
||||
objWithReplacements.Model[key] = modelWithReplacements;
|
||||
});
|
||||
|
||||
return objWithReplacements;
|
||||
}
|
||||
|
||||
// Support method for processing the page data from the CMS call.
|
||||
// widgets = current widget collection used by page.
|
||||
// baseResponse = contains the widgets from the base page.
|
||||
// clientResponse = contains the widgets from the client override page. (null if none)
|
||||
function processPageData(baseResponse, clientResponse) {
|
||||
const pageDataFromCms = {};
|
||||
let widgets = [];
|
||||
|
||||
if (!baseResponse?.data?.Result) {
|
||||
console.error('No result data found'); // Something has gone terribly wrong.
|
||||
return {};
|
||||
}
|
||||
if (!clientResponse?.data?.Result) {
|
||||
widgets = baseResponse.data.Result;
|
||||
} else {
|
||||
// Override any base widgets with the client override widgets if found.
|
||||
baseResponse.data.Result.forEach((baseWidget) => {
|
||||
let found = false;
|
||||
clientResponse.data.Result.forEach((clientWidget) => {
|
||||
if (clientWidget.Name === baseWidget.Name) {
|
||||
widgets.push(clientWidget);
|
||||
found = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!found) {
|
||||
widgets.push(baseWidget);
|
||||
}
|
||||
});
|
||||
|
||||
// Add any unique client widgets that does not exist in the current main widgets collection.
|
||||
clientResponse.data.Result.forEach((clientWidget) => {
|
||||
let found = false;
|
||||
widgets.forEach((currentWidget) => {
|
||||
if (clientWidget.Name === currentWidget.Name) {
|
||||
found = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!found) {
|
||||
widgets.push(clientWidget);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
widgets.forEach((widget) => {
|
||||
// Global state value replacement.
|
||||
const widgetWithReplacements = findAndReplaceGlobalStateValues(widget.Model,
|
||||
widget.Name);
|
||||
|
||||
// If we already have this widget, push it on the collection
|
||||
if (widgetWithReplacements.Name in pageDataFromCms) {
|
||||
pageDataFromCms[widgetWithReplacements.Name].push(widgetWithReplacements.Model);
|
||||
return;
|
||||
}
|
||||
|
||||
pageDataFromCms[widgetWithReplacements.Name] = [
|
||||
widgetWithReplacements.Model
|
||||
];
|
||||
});
|
||||
|
||||
Object.keys(pageDataFromCms).forEach((key) => {
|
||||
if (pageDataFromCms[key].length === 1) {
|
||||
pageDataFromCms[key] = pageDataFromCms[key][0];
|
||||
}
|
||||
});
|
||||
|
||||
return pageDataFromCms;
|
||||
}
|
||||
|
||||
export function fetchCmsContentForPage(issPage) {
|
||||
const store = useMainStore();
|
||||
const { clientName } = store.issConfig;
|
||||
const { accountNumber } = store.issConfig;
|
||||
const clientOverride = (clientName.length > 0 && accountNumber > 0);
|
||||
|
||||
return store.getPageData(issPage)
|
||||
// Get the base/default page first.
|
||||
.then((baseResponse) => {
|
||||
if (!clientOverride) {
|
||||
// Return the base page if there are no client override.
|
||||
return processPageData(baseResponse, null);
|
||||
}
|
||||
// Else get the client override page.
|
||||
const pageName = `${issPage}_${clientName.toLowerCase().replace(/ /g, '')}`;
|
||||
|
||||
return store.getPageData(pageName)
|
||||
.then((clientResponse) =>
|
||||
// Process the client override if it exists.
|
||||
processPageData(baseResponse, clientResponse),
|
||||
(error) => {
|
||||
console.error(error);
|
||||
// Process the just the base if no client override exists.
|
||||
return processPageData(baseResponse, null);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function mapStringToModal(str) {
|
||||
const startIndex = str.indexOf(`{${dynamicStrings.MODAL_LINK}`);
|
||||
let linkToReplace = str.substring(startIndex, str.length);
|
||||
|
|
@ -218,7 +201,6 @@ function mapStringToState(str) {
|
|||
// Our final string value that will be built from the matches.
|
||||
const stringBuilder = '';
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const match of globalStateMatches) {
|
||||
// Reset store state for each match.
|
||||
const valueFromStore = getStoreValueFromString(match[2]);
|
||||
|
|
@ -234,13 +216,27 @@ function mapStringToState(str) {
|
|||
}
|
||||
|
||||
// Concatenate the string.
|
||||
// TODO: Assignment to function parm
|
||||
str = `${stringBuilder} ${stringWithReplacement}`;
|
||||
}
|
||||
|
||||
return str.trimStart();
|
||||
}
|
||||
|
||||
function getStoreValueFromString(str) {
|
||||
if (!str) return '';
|
||||
|
||||
let storeOrStateObject = useMainStore();
|
||||
for (const s of str.split('.')) {
|
||||
if (s === 'getters') continue; // For backward compatibility
|
||||
if (storeOrStateObject[s] != undefined) {
|
||||
storeOrStateObject = storeOrStateObject[s];
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return storeOrStateObject ?? '';
|
||||
}
|
||||
|
||||
/// ////////////////////////////////
|
||||
// If Statement Processing Logic //
|
||||
/// ////////////////////////////////
|
||||
|
|
@ -254,6 +250,8 @@ function mapStringToState(str) {
|
|||
*/
|
||||
export function processIfStatements(str, ifConditionKeyword, replacePlaceholderCallback) {
|
||||
const containsRelevantIfStatement = new RegExp(`{if:${ifConditionKeyword}:.+?}`, 'g').test(str);
|
||||
|
||||
const hasEmbeddedCrLf = /\r?\n|\r/g.test(str);
|
||||
if (!containsRelevantIfStatement) {
|
||||
return str;
|
||||
}
|
||||
|
|
@ -271,13 +269,11 @@ export function processIfStatements(str, ifConditionKeyword, replacePlaceholderC
|
|||
|
||||
function getAndFlagFirstNonNestedIfStatementWithKeyword(matches, ifConditionKeyword) {
|
||||
let index = 0;
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const match of matches) {
|
||||
if (match.groups.isIfStatement && match.groups.ifConditionType === ifConditionKeyword) {
|
||||
let interiorIndex = 0;
|
||||
let nestedLevel = 0;
|
||||
let elseStatementIndex = null;
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const interiorMatch of matches.slice(index + 1)) {
|
||||
if (interiorMatch.groups.isIfStatement) {
|
||||
if (interiorMatch.groups.ifConditionType === ifConditionKeyword) {
|
||||
|
|
@ -406,7 +402,6 @@ export function doesCopyContainTextLink(copy) {
|
|||
export function setupModalLinks(context) {
|
||||
context.$nextTick(() => {
|
||||
const elements = document.getElementsByClassName('modal-text');
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const element of elements) {
|
||||
const target = element.getAttribute('modalTarget');
|
||||
if (target) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import cookieNames from '@/constants/cookie-names';
|
||||
import applicationConfig from '@/constants/application-config';
|
||||
import { cookieNames } from '@/constants/cookie-names';
|
||||
import { applicationConfig } from '@/constants/application-config';
|
||||
import { useMainStore } from '@/store';
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import damageCustomLabels from '@/constants/damage-custom-labels';
|
||||
import damageLocationsSelected from '@/constants/damage-locations-selected';
|
||||
import { damageLocationsSelected } from '@/constants/damage-locations-selected';
|
||||
import { useMainStore } from '@/store';
|
||||
|
||||
export function getDamageString() {
|
||||
|
|
@ -44,7 +44,6 @@ function hasMatchingReplacementOption(vehicleDamageOptions, selectedGlassToRepla
|
|||
Rear: 'backGlassOptions'
|
||||
};
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const glassToReplace of selectedGlassToReplace) {
|
||||
const propName = optionsMap[glassToReplace.glassLocation];
|
||||
const { availableReplacementOptions } = vehicleDamageOptions[propName];
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import { randomUUID } from 'crypto';
|
||||
|
||||
export function getRandomInt(min = 0, max = 1000) {
|
||||
const minCeiling = Math.ceil(min);
|
||||
const maxFloor = Math.floor(max);
|
||||
return Math.floor(Math.random() * (maxFloor - minCeiling) + minCeiling); // The maximum is exclusive and the minimum is inclusive
|
||||
min = Math.ceil(min);
|
||||
max = Math.floor(max);
|
||||
return Math.floor(Math.random() * (max - min) + min); // The maximum is exclusive and the minimum is inclusive
|
||||
}
|
||||
|
||||
export function getRandomGuid() {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ describe('event-bus.js', () => {
|
|||
it('removes items when readandpop is called', () => {
|
||||
useMainStore().eventBusItem.mockReturnValueOnce(event);
|
||||
|
||||
eventBus.readAndPopEventFromBus(globalEvents.Categories.GLOBAL_ALERT,
|
||||
const eventValue = eventBus.readAndPopEventFromBus(globalEvents.Categories.GLOBAL_ALERT,
|
||||
globalEvents.SubCategories.PAGE_NOT_FOUND);
|
||||
|
||||
expect(useMainStore().eventBusItem).toBeCalledTimes(1);
|
||||
|
|
@ -35,7 +35,7 @@ describe('event-bus.js', () => {
|
|||
it("doesn't try to remove items when readandpop is called and item doesn't exist", () => {
|
||||
useMainStore().eventBusItem.mockReturnValueOnce(undefined);
|
||||
|
||||
eventBus.readAndPopEventFromBus(globalEvents.Categories.GLOBAL_ALERT,
|
||||
const eventValue = eventBus.readAndPopEventFromBus(globalEvents.Categories.GLOBAL_ALERT,
|
||||
globalEvents.SubCategories.PAGE_NOT_FOUND);
|
||||
|
||||
expect(useMainStore().eventBusItem).toBeCalledTimes(1);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { defineRule } from 'vee-validate';
|
||||
import errorMessages from '@/constants/error-messages';
|
||||
import { errorMessages } from '@/constants/error-messages';
|
||||
import globalRules from '@/constants/global-rules';
|
||||
import { required, regex } from '@/helpers/validation-rules';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const settleAllPromises = (promiseResultMap) => {
|
||||
export function settleAllPromises(promiseResultMap) {
|
||||
// Pull our keys out of the promise 'table'
|
||||
const promiseNames = Object.entries(promiseResultMap);
|
||||
|
||||
|
|
@ -22,6 +22,4 @@ const settleAllPromises = (promiseResultMap) => {
|
|||
|
||||
return resultMap;
|
||||
});
|
||||
};
|
||||
|
||||
export default settleAllPromises;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import settleAllPromises from '@/helpers/layout-helper';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper';
|
||||
|
||||
it('layout-helper: Should settle all promises and return mapped promise results', () => {
|
||||
// Arrange
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import applicationConfig from '@/constants/application-config';
|
||||
import { applicationConfig } from '@/constants/application-config';
|
||||
import { getISSCookie } from '@/helpers/cookie-helper.js';
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import {
|
|||
isSavedSessionStillActive,
|
||||
getDateForSavedSessionTimeout
|
||||
} from '@/helpers/session-helper';
|
||||
import applicationConfig from '@/constants/application-config';
|
||||
import { applicationConfig } from '@/constants/application-config';
|
||||
|
||||
describe('isAnalyticsSessionStillActive', () => {
|
||||
test('isAnalyticsSessionStillActive, should return true', () => {
|
||||
|
|
@ -12,7 +12,6 @@ describe('isAnalyticsSessionStillActive', () => {
|
|||
const mockDate = new Date(new Date().toUTCString());
|
||||
mockDate.setDate(mockDate.getDate() + 1);
|
||||
|
||||
// TODO: Fix assignment
|
||||
cookieHelper.getISSCookie = jest
|
||||
.spyOn(cookieHelper, 'getISSCookie')
|
||||
.mockReturnValue({ LastTouched: mockDate });
|
||||
|
|
@ -29,7 +28,6 @@ describe('isAnalyticsSessionStillActive', () => {
|
|||
const mockDate = new Date(new Date().toUTCString());
|
||||
mockDate.setDate(mockDate.getDate() - 1);
|
||||
|
||||
// TODO: Fix assignment
|
||||
cookieHelper.getISSCookie = jest
|
||||
.spyOn(cookieHelper, 'getISSCookie')
|
||||
.mockReturnValue({ LastTouched: mockDate });
|
||||
|
|
@ -48,7 +46,6 @@ describe('isSavedSessionStillActive', () => {
|
|||
const mockDate = new Date(new Date().toUTCString());
|
||||
mockDate.setDate(mockDate.getDate() + 1);
|
||||
|
||||
// TODO: Fix assignment
|
||||
cookieHelper.getISSCookie = jest
|
||||
.spyOn(cookieHelper, 'getISSCookie')
|
||||
.mockReturnValue({ SavedSessionTimeoutDate: mockDate });
|
||||
|
|
@ -65,7 +62,6 @@ describe('isSavedSessionStillActive', () => {
|
|||
const mockDate = new Date(new Date().toUTCString());
|
||||
mockDate.setDate(mockDate.getDate() - 1);
|
||||
|
||||
// TODO: Fix assignment
|
||||
cookieHelper.getISSCookie = jest
|
||||
.spyOn(cookieHelper, 'getISSCookie')
|
||||
.mockReturnValue({ SavedSessionTimeoutDate: mockDate });
|
||||
|
|
|
|||
|
|
@ -1,17 +1,19 @@
|
|||
import { createTestingPinia } from '@pinia/testing';
|
||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios.js';
|
||||
import { RouterLinkStub } from '@vue/test-utils';
|
||||
import navigationScenarios from '@/router/router-constants/navigation-scenarios.js';
|
||||
import vehicleCategories from '@/constants/vehicle-categories.js';
|
||||
import issPageValues from '@/router/router-constants/issPage-values';
|
||||
import cookieNames from '@/constants/cookie-names';
|
||||
import { vehicleCategories } from '@/constants/vehicle-categories.js';
|
||||
import { issPageValues } from '@/router/router-constants/issPage-values';
|
||||
import { cookieNames } from '@/constants/cookie-names';
|
||||
import { Form } from 'vee-validate';
|
||||
import baseMixin from '@/mixins/base-mixin';
|
||||
import { getCookieDomainValue, setCookieProperties } from '@/helpers/cookie-helper';
|
||||
import {
|
||||
getCookieDomainValue,
|
||||
setCookieProperties
|
||||
} from '@/helpers/cookie-helper';
|
||||
import { GaActions } from '@/constants/analytics';
|
||||
import queryStrings from '@/constants/query-strings';
|
||||
import { queryStrings } from '@/constants/query-strings';
|
||||
import { useMainStore } from '@/store';
|
||||
import { mapStores } from 'pinia';
|
||||
|
||||
import { createTestingPinia } from '@pinia/testing';
|
||||
|
||||
const pinia = createTestingPinia();
|
||||
useMainStore(pinia);
|
||||
|
|
@ -57,9 +59,7 @@ export function getMountOptions(mockData) {
|
|||
|
||||
// Heritage integration common methods
|
||||
export const cookies = {
|
||||
[cookieNames.ISS_SESSION_INFO]:
|
||||
// eslint-disable-next-line max-len
|
||||
'{"ReferralNumber":"1566818","ReferralDate":"2022-03-15T10:56:24.597","ReferralCorrelationId":"404d2b04-f86e-45c3-b373-127b6217b060","ShouldResetState":false}',
|
||||
[cookieNames.ISS_SESSION_INFO]: '{"ReferralNumber":"1566818","ReferralDate":"2022-03-15T10:56:24.597","ReferralCorrelationId":"404d2b04-f86e-45c3-b373-127b6217b060","ShouldResetState":false}',
|
||||
UNIQUE_SESSION_ID: '33756020-b58e-4ec7-b8b8-3f1576719c40',
|
||||
anotherCookie: '{}',
|
||||
someOtherCookie: '{}',
|
||||
|
|
@ -147,6 +147,10 @@ export function getMountOptions(mockData) {
|
|||
return { global };
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export function getMockOrderInfo(
|
||||
mockReferralNumber,
|
||||
mockCorrelationId,
|
||||
|
|
@ -164,4 +168,8 @@ export function getMockOrderInfo(
|
|||
crmCustomerId: crmCustomerId,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import { required, regex } from '@/helpers/validation-rules';
|
||||
import { required } from '@/helpers/validation-rules';
|
||||
import { regex } from '@/helpers/validation-rules';
|
||||
|
||||
describe('validation-rules.vue', () => {
|
||||
test('required rules should return error if value missing', () => {
|
||||
|
|
|
|||
|
|
@ -6,84 +6,6 @@ import { mount, shallowMount } from '@vue/test-utils';
|
|||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||
|
||||
let autocompleteElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param root0
|
||||
* @param root0.mountOptions
|
||||
* @param root0.props
|
||||
* @param root0.isShallowMount
|
||||
* @param root0.querySelectorFunction
|
||||
* @param root0.geocoderResult
|
||||
*/
|
||||
function setupMocks({
|
||||
mountOptions,
|
||||
props,
|
||||
isShallowMount = true,
|
||||
querySelectorFunction,
|
||||
geocoderResult = ['1234 Test Street']
|
||||
}) {
|
||||
const resultingMountOptions = getMountOptions({
|
||||
...mountOptions,
|
||||
router: {
|
||||
navigate: jest.fn()
|
||||
},
|
||||
loadScript: jest.fn().mockResolvedValue()
|
||||
});
|
||||
|
||||
window.google = {
|
||||
maps: {
|
||||
event: {
|
||||
addListener: jest
|
||||
.fn()
|
||||
.mockImplementation((element, eventName, callbackFunction) => {
|
||||
/**
|
||||
*
|
||||
* @param e
|
||||
*/
|
||||
function interceptedCallbackFunction(e) {
|
||||
callbackFunction(e.detail);
|
||||
}
|
||||
// selectedPlace = "Woogly";
|
||||
element.addEventListener(eventName, interceptedCallbackFunction);
|
||||
}),
|
||||
removeListener: jest.fn(),
|
||||
clearInstanceListeners: jest.fn()
|
||||
},
|
||||
places: {
|
||||
Autocomplete: jest.fn().mockImplementation((el) => el)
|
||||
},
|
||||
Geocoder: class Geocoder {
|
||||
// constructor();
|
||||
|
||||
geocode(request, callback) {
|
||||
callback([geocoderResult], true);
|
||||
}
|
||||
},
|
||||
GeocoderStatus: {
|
||||
OK: true
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (props) resultingMountOptions.propsData = props;
|
||||
|
||||
const wrapper = isShallowMount
|
||||
? shallowMount(addressQuestions, resultingMountOptions)
|
||||
: mount(addressQuestions, resultingMountOptions);
|
||||
document.querySelector = jest.fn().mockImplementation((query) => {
|
||||
let result = null;
|
||||
if (query === '.pac-container') result = document.createElement('div');
|
||||
else if (querySelectorFunction) {
|
||||
result = querySelectorFunction(query);
|
||||
}
|
||||
|
||||
return result ?? null;
|
||||
});
|
||||
|
||||
return { wrapper };
|
||||
}
|
||||
|
||||
describe('address-questions.vue', () => {
|
||||
beforeEach(() => {
|
||||
// Create the `addressField1` element (autocomplete's input)
|
||||
|
|
@ -534,3 +456,80 @@ describe('address-questions.vue', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
*
|
||||
* @param root0
|
||||
* @param root0.mountOptions
|
||||
* @param root0.props
|
||||
* @param root0.isShallowMount
|
||||
* @param root0.querySelectorFunction
|
||||
* @param root0.geocoderResult
|
||||
*/
|
||||
function setupMocks({
|
||||
mountOptions,
|
||||
props,
|
||||
isShallowMount = true,
|
||||
querySelectorFunction,
|
||||
geocoderResult = ['1234 Test Street']
|
||||
}) {
|
||||
const resultingMountOptions = getMountOptions({
|
||||
...mountOptions,
|
||||
router: {
|
||||
navigate: jest.fn()
|
||||
},
|
||||
loadScript: jest.fn().mockResolvedValue()
|
||||
});
|
||||
|
||||
window.google = {
|
||||
maps: {
|
||||
event: {
|
||||
addListener: jest
|
||||
.fn()
|
||||
.mockImplementation((element, eventName, callbackFunction) => {
|
||||
/**
|
||||
*
|
||||
* @param e
|
||||
*/
|
||||
function interceptedCallbackFunction(e) {
|
||||
callbackFunction(e.detail);
|
||||
}
|
||||
// selectedPlace = "Woogly";
|
||||
element.addEventListener(eventName, interceptedCallbackFunction);
|
||||
}),
|
||||
removeListener: jest.fn(),
|
||||
clearInstanceListeners: jest.fn()
|
||||
},
|
||||
places: {
|
||||
Autocomplete: jest.fn().mockImplementation((el) => el)
|
||||
},
|
||||
Geocoder: class Geocoder {
|
||||
// constructor();
|
||||
|
||||
geocode(request, callback) {
|
||||
callback([geocoderResult], true);
|
||||
}
|
||||
},
|
||||
GeocoderStatus: {
|
||||
OK: true
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (props) resultingMountOptions.propsData = props;
|
||||
|
||||
const wrapper = isShallowMount
|
||||
? shallowMount(addressQuestions, resultingMountOptions)
|
||||
: mount(addressQuestions, resultingMountOptions);
|
||||
document.querySelector = jest.fn().mockImplementation((query) => {
|
||||
let result = null;
|
||||
if (query === '.pac-container') result = document.createElement('div');
|
||||
else if (querySelectorFunction) {
|
||||
result = querySelectorFunction(query);
|
||||
}
|
||||
|
||||
return result ?? null;
|
||||
});
|
||||
|
||||
return { wrapper };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,12 +92,12 @@
|
|||
import textboxQuestion from '@/digital-components/textbox-question/textbox-question';
|
||||
import dropdownQuestion from '@/digital-components/dropdown-question/dropdown-question';
|
||||
import alert from '@/ux-components/alert/alert';
|
||||
import applicationConfig from '@/constants/application-config.js';
|
||||
import { applicationConfig } from '@/constants/application-config.js';
|
||||
import { defineRule } from 'vee-validate';
|
||||
import { required, regex } from '@/helpers/validation-rules';
|
||||
import errorMessages from '@/constants/error-messages';
|
||||
import states from '@/constants/states';
|
||||
import endpoints from '@/constants/endpoints';
|
||||
import { errorMessages } from '@/constants/error-messages';
|
||||
import { states } from '@/constants/states';
|
||||
import { endpoints } from '@/constants/endpoints';
|
||||
|
||||
// DEFINE VALIDATION RULES
|
||||
defineRule('street-address-required', required(errorMessages.STREET_ADDRESS_REQUIRED));
|
||||
|
|
@ -125,7 +125,6 @@ export default {
|
|||
})
|
||||
},
|
||||
validationRules: String,
|
||||
// TODO: Fix assignment
|
||||
includeStreetAddress2: false
|
||||
},
|
||||
emits: ['update:modelValue'],
|
||||
|
|
@ -294,7 +293,6 @@ export default {
|
|||
self.matchFound = true;
|
||||
self.addressModel.streetAddress = '';
|
||||
self.$nextTick(() => {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const component of place.address_components) {
|
||||
const componentType = component.types[0];
|
||||
|
||||
|
|
@ -342,7 +340,7 @@ export default {
|
|||
})
|
||||
.catch(() => {
|
||||
// Failed to fetch script
|
||||
console.error('Unable to load Google Places API script');
|
||||
console.log('Unable to load Google Places API script');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { shallowMount } from '@vue/test-utils';
|
||||
import ButtonQuestionModal from '@/iss-components/button-question-modal/button-question-modal';
|
||||
import ButtonQuestionModal from './button-question-modal';
|
||||
|
||||
const mockCmsContent = {
|
||||
QuestionText: 'What caused damage.',
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
suppressLoader
|
||||
:buttonText="ModalSelectButtonText"
|
||||
data-bs-dismiss="modal"
|
||||
@clickEvent="buttonClick" />
|
||||
@click-event="buttonClick" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { mount } from '@vue/test-utils';
|
||||
import crypto from 'crypto';
|
||||
import contentGroupModal from '@/iss-components/content-group-modal/content-group-modal';
|
||||
import contentGroupModal from './content-group-modal';
|
||||
|
||||
global.crypto = crypto;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
:ref="ModalName"
|
||||
:modalId="ModalName"
|
||||
:footerButtonText="ModalCloseButtonText"
|
||||
@footerButtonEvent="footerButtonClick">
|
||||
@footer-button-event="footerButtonClick">
|
||||
<img
|
||||
:src="ModalImage"
|
||||
class="mw-100 d-flex mx-auto mb-4"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { shallowMount } from '@vue/test-utils';
|
||||
import loadingModal from './loading-modal';
|
||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||
import loadingModal from '@/iss-components/loading-modal/loading-modal';
|
||||
|
||||
jest.mock('@/assets/img/loader.gif', () => 'loader.gif');
|
||||
jest.mock('@/assets/img/windshield.png', () => 'windshield.png');
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { shallowMount } from '@vue/test-utils';
|
||||
import navButton from '@/iss-components/nav-button/nav-button';
|
||||
import navButton from './nav-button';
|
||||
|
||||
describe('NavButton', () => {
|
||||
it('should display input when type is button', () => {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default ({
|
||||
name: 'nav-button',
|
||||
props: {
|
||||
|
|
|
|||
|
|
@ -17,69 +17,6 @@ jest.mock('@/helpers/cms-content-helper', () => ({
|
|||
fetchCmsContentForPage: jest.fn()
|
||||
}));
|
||||
|
||||
function setupMocks() {
|
||||
const baseStoreGettersPageData = () => ({
|
||||
partsOrQuestions: [
|
||||
{
|
||||
parts: null,
|
||||
partQuestions: [
|
||||
{
|
||||
questionSequence: 1,
|
||||
questionText:
|
||||
'Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?',
|
||||
answers: [
|
||||
{
|
||||
answerResult: '',
|
||||
answerText: 'Yes',
|
||||
nextQuestionSequence: 2
|
||||
},
|
||||
{
|
||||
answerResult: '',
|
||||
answerText: 'No',
|
||||
nextQuestionSequence: 3
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
glassLocation: 'Windshield',
|
||||
glassName: 'Single',
|
||||
answerKey: 'Windshield-Single',
|
||||
answerData: null
|
||||
}
|
||||
]
|
||||
});
|
||||
const baseStoreGettersDamage = () => ({
|
||||
partsQuestionAnswers: [
|
||||
{
|
||||
glassLocation: 'Windshield',
|
||||
glassName: 'Single',
|
||||
result: 'FW04848',
|
||||
answeredQuestions: [
|
||||
{
|
||||
questionText:
|
||||
'Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?',
|
||||
selectedAnswerText: 'Yes',
|
||||
questionNum: 1
|
||||
},
|
||||
{
|
||||
questionText:
|
||||
'Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?',
|
||||
selectedAnswerText: 'Yes',
|
||||
questionNum: 2
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
const mountOptions = getMountOptions({
|
||||
mixins: [baseMixin, vehicleQuestionsMixin]
|
||||
});
|
||||
mountOptions.attachTo = document.body;
|
||||
const wrapper = shallowMount(questionsPageLayout, mountOptions);
|
||||
|
||||
return { wrapper };
|
||||
}
|
||||
|
||||
describe('questionsPageLayout.vue', () => {
|
||||
describe('method showThisQuestionChain...', () => {
|
||||
test('Should return true if index prop and passed index match', async () => {
|
||||
|
|
@ -243,3 +180,66 @@ describe('questionsPageLayout.vue', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
function setupMocks() {
|
||||
const baseStoreGettersPageData = () => ({
|
||||
partsOrQuestions: [
|
||||
{
|
||||
parts: null,
|
||||
partQuestions: [
|
||||
{
|
||||
questionSequence: 1,
|
||||
questionText:
|
||||
'Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?',
|
||||
answers: [
|
||||
{
|
||||
answerResult: '',
|
||||
answerText: 'Yes',
|
||||
nextQuestionSequence: 2
|
||||
},
|
||||
{
|
||||
answerResult: '',
|
||||
answerText: 'No',
|
||||
nextQuestionSequence: 3
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
glassLocation: 'Windshield',
|
||||
glassName: 'Single',
|
||||
answerKey: 'Windshield-Single',
|
||||
answerData: null
|
||||
}
|
||||
]
|
||||
});
|
||||
const baseStoreGettersDamage = () => ({
|
||||
partsQuestionAnswers: [
|
||||
{
|
||||
glassLocation: 'Windshield',
|
||||
glassName: 'Single',
|
||||
result: 'FW04848',
|
||||
answeredQuestions: [
|
||||
{
|
||||
questionText:
|
||||
'Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?',
|
||||
selectedAnswerText: 'Yes',
|
||||
questionNum: 1
|
||||
},
|
||||
{
|
||||
questionText:
|
||||
'Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?',
|
||||
selectedAnswerText: 'Yes',
|
||||
questionNum: 2
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
const mountOptions = getMountOptions({
|
||||
mixins: [baseMixin, vehicleQuestionsMixin]
|
||||
});
|
||||
mountOptions.attachTo = document.body;
|
||||
const wrapper = shallowMount(questionsPageLayout, mountOptions);
|
||||
|
||||
return { wrapper };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
class="mt-5"
|
||||
cmsWidgetName="SiteFooterWidget"
|
||||
:isForwardActionDisabled="!isMetaValid"
|
||||
@backClicked="handleBackButtonAction"
|
||||
@back-clicked="handleBackButtonAction"
|
||||
@ForwardClicked="handleForwardButtonAction" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { mount } from '@vue/test-utils';
|
||||
import siteFooter from '@/iss-components/site-footer/site-footer';
|
||||
import siteFooter from './site-footer';
|
||||
|
||||
const mockMixin = {
|
||||
methods: {
|
||||
|
|
@ -10,26 +10,24 @@ const mockMixin = {
|
|||
};
|
||||
|
||||
describe('site-footer.vue', () => {
|
||||
// TODO: Test needs to be fixed
|
||||
it.skip('Should emit ForwardClicked on button click', async () => {
|
||||
it('Should emit ForwardClicked on button click', async () => {
|
||||
// Act
|
||||
const wrapper = mount(siteFooter, {
|
||||
mixins: [mockMixin]
|
||||
});
|
||||
wrapper.vm.buttonClick();
|
||||
// Assert
|
||||
expect(wrapper.emitted().forwardClicked[0]).toHaveBeenCalled();
|
||||
expect(wrapper.emitted().forwardClicked[0]).toHaveBeenCalled;
|
||||
});
|
||||
|
||||
// TODO: Test needs to be fixed
|
||||
it.skip('Should emit BackClicked on link click', async () => {
|
||||
it('Should emit BackClicked on link click', async () => {
|
||||
// Act
|
||||
const wrapper = mount(siteFooter, {
|
||||
mixins: [mockMixin]
|
||||
});
|
||||
wrapper.vm.linkClick();
|
||||
// Assert
|
||||
expect(wrapper.emitted().backClicked[0]).toHaveBeenCalled();
|
||||
expect(wrapper.emitted().backClicked[0]).toHaveBeenCalled;
|
||||
});
|
||||
|
||||
it('Should change button text when update button text is called', async () => {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
data-bs-target="#footerModal"
|
||||
data-bs-dismiss="modal"
|
||||
data-test-id="site-footer-main-button"
|
||||
@clickEvent="buttonClick" />
|
||||
@click-event="buttonClick" />
|
||||
</div>
|
||||
<div
|
||||
v-if="!isBackButtonHidden"
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
data-bs-target="#footerModal"
|
||||
data-bs-dismiss="modal"
|
||||
data-test-id="site-footer-back-button"
|
||||
@clickEvent="linkClick" />
|
||||
@click-event="linkClick" />
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
<script>
|
||||
import textLink from '@/ux-components/text-link/text-link';
|
||||
import buttonMain from '@/ux-components/button-main/button-main';
|
||||
import issPageValues from '@/router/router-constants/issPage-values';
|
||||
import { issPageValues } from '@/router/router-constants/issPage-values';
|
||||
|
||||
export default {
|
||||
name: 'site-footer',
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { mount, shallowMount } from '@vue/test-utils';
|
||||
import menuModal from '@/iss-components/site-header/menu-modal/menu-modal';
|
||||
import menuModal from './menu-modal';
|
||||
|
||||
describe('menu-modal.vue', () => {
|
||||
it('Should return text Footer Navigation', async () => {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ function setupMocks({
|
|||
|
||||
describe('site-header', () => {
|
||||
test('renders the logo image', () => {
|
||||
const wrapper = setupMocks({ mountOptionsMockData: {} });
|
||||
const wrapper = setupMocks({mountOptionsMockData: {} });
|
||||
|
||||
expect(wrapper.find('img')).toBeTruthy();
|
||||
wrapper.unmount();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { shallowMount } from '@vue/test-utils';
|
||||
import buttonBack from '@/iss-components/site-sub-header/button-back/button-back';
|
||||
import buttonBack from './button-back';
|
||||
|
||||
describe('back button', () => {
|
||||
test('renders a button', () => {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<buttonBack
|
||||
v-if="hasBackButton"
|
||||
:backButtonAccessibleText="backButtonAccessibleText"
|
||||
@clickEvent="clickEvent" />
|
||||
@click-event="clickEvent" />
|
||||
</h5>
|
||||
</div>
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { shallowMount } from '@vue/test-utils';
|
|||
import App from '@/App';
|
||||
import { createPinia } from 'pinia';
|
||||
import { createApp } from 'vue';
|
||||
import steeringTextModal from '@/iss-components/steering-text/steering-text';
|
||||
import steeringTextModal from './steering-text';
|
||||
|
||||
const mockCmsContent = {
|
||||
BodyText: 'MASteeringText'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { shallowMount } from '@vue/test-utils';
|
||||
import vehicleCategories from '@/constants/vehicle-categories.js';
|
||||
import { vehicleCategories } from '@/constants/vehicle-categories.js';
|
||||
import { useMainStore } from '@/store';
|
||||
import { createApp } from 'vue';
|
||||
import { createPinia, mapStores } from 'pinia';
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
import addressLookup from '@/layouts/address-lookup/address-lookup';
|
||||
|
||||
// Supporting Files
|
||||
import settleAllPromises from '@/helpers/layout-helper.js';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper.js';
|
||||
import { shallowMount } from '@vue/test-utils';
|
||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||
import { useMainStore } from '@/store';
|
||||
import navigationScenarios from '@/router/router-constants/navigation-scenarios';
|
||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
|
||||
|
||||
jest.mock('@/helpers/damage-helper', () => ({
|
||||
isGlassAvailableForCarId: jest.fn().mockImplementation(() => true),
|
||||
|
|
@ -14,7 +14,9 @@ jest.mock('@/helpers/damage-helper', () => ({
|
|||
}));
|
||||
|
||||
// Mock our module for promises.
|
||||
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
|
||||
jest.mock('@/helpers/layout-helper.js', () => ({
|
||||
settleAllPromises: jest.fn()
|
||||
}));
|
||||
|
||||
function setupMocks({
|
||||
lookupVinbyAddressResponse,
|
||||
|
|
@ -160,7 +162,6 @@ describe('address-lookup.vue', () => {
|
|||
expect(wrapper.findComponent({ ref: 'alertMatchedTwoIdenticalYMMVehicle' }).isVisible()).toBe(true);
|
||||
});
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
test('if the looking up VIN by address is not allowed in the state selected display the Vin Lookup By HomeAddress Not Allowed Alert', async () => {
|
||||
// Arrange
|
||||
const mockRegistrationAddress = {
|
||||
|
|
@ -351,7 +352,6 @@ describe('address-lookup.vue', () => {
|
|||
carsFound);
|
||||
});
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
test('if a different vehicle is found than the one entered and the selected glass is not available for that vehicle, navigate back to vehicle-damage page', async () => {
|
||||
// Arrange
|
||||
const mockRegistrationAddress = {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
ref="theForm"
|
||||
v-slot="{ meta }"
|
||||
@submit="onSubmit"
|
||||
@invalidSubmit="onInvalidSubmit">
|
||||
@invalid-submit="onInvalidSubmit">
|
||||
<div class="page-container-grouped-styles">
|
||||
<div class="fade-on-route-transition position-relative">
|
||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
:isDisabled="!meta.valid"
|
||||
:isForwardActionDisabled="!meta.valid"
|
||||
@ForwardClicked="forwardButtonAction"
|
||||
@backClicked="backButtonAction" />
|
||||
@back-clicked="backButtonAction" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -82,13 +82,14 @@ import vehicleBanner from '@/iss-components/vehicle-banner/vehicle-banner';
|
|||
import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header';
|
||||
import customerQuestions from '@/layouts/address-lookup/customer-questions/customer-questions';
|
||||
import alert from '@/ux-components/alert/alert';
|
||||
import textboxQuestion from '@/digital-components/textbox-question/textbox-question';
|
||||
|
||||
import { Form } from 'vee-validate';
|
||||
|
||||
// Supporting files
|
||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||
import settleAllPromises from '@/helpers/layout-helper';
|
||||
import routerParams from '@/router/router-constants/router-params';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper';
|
||||
import { routerParams } from '@/router/router-constants/router-params';
|
||||
import { getDamageString, isGlassAvailableForCarId } from '@/helpers/damage-helper';
|
||||
|
||||
import vinPagesMixin from '@/mixins/vin-pages-mixin';
|
||||
|
|
@ -102,6 +103,7 @@ export default {
|
|||
vehicleBanner,
|
||||
siteSubHeader,
|
||||
customerQuestions,
|
||||
textboxQuestion,
|
||||
alert,
|
||||
// eslint-disable-next-line vue/no-reserved-component-names
|
||||
Form
|
||||
|
|
@ -146,9 +148,7 @@ export default {
|
|||
'HeadlineText').replaceAll('{custom:damage}', getDamageString());
|
||||
},
|
||||
AlertMatchedDifferentVehicleBody() {
|
||||
// eslint-disable-next-line max-len
|
||||
const vinYmmFound = `${this.customAlertData?.vehicleInfo?.year} ${this.customAlertData?.vehicleInfo?.make} ${this.customAlertData?.vehicleInfo?.model}`;
|
||||
// eslint-disable-next-line max-len
|
||||
const vinYmmExpected = `${this.mainStore.order.vehicle.year} ${this.mainStore.order.vehicle.make} ${this.mainStore.order.vehicle.model}`;
|
||||
|
||||
return this.getCmsContent('AlertMatchedDifferentVehicleWidget', 'BodyText')
|
||||
|
|
@ -161,9 +161,7 @@ export default {
|
|||
'HeadlineText').replaceAll('{custom:damage}', getDamageString());
|
||||
},
|
||||
AlertMatchedTwoIdenticalYMMVehicleBody() {
|
||||
// eslint-disable-next-line max-len
|
||||
const vinYmmsFound = `${this.customAlertData?.vehicleInfo?.year} ${this.customAlertData?.vehicleInfo?.make} ${this.customAlertData?.vehicleInfo?.model} ${this.customAlertData?.vehicleInfo?.style}`;
|
||||
// eslint-disable-next-line max-len
|
||||
const vinYmmsExpected = `${this.mainStore.order.vehicle.year} ${this.mainStore.order.vehicle.make} ${this.mainStore.order.vehicle.model} ${this.mainStore.order.vehicle.style}`;
|
||||
|
||||
return this.getCmsContent('AlertMatchedTwoIdenticalYMMVehicleWidget', 'BodyText')
|
||||
|
|
@ -172,18 +170,15 @@ export default {
|
|||
.replaceAll('{custom:vinYmmsExpected}', vinYmmsExpected);
|
||||
},
|
||||
isTwoIdenticalYMMVehicleFound() {
|
||||
// eslint-disable-next-line max-len
|
||||
const vinYmmFound = `${this.customAlertData?.vehicleInfo?.year} ${this.customAlertData?.vehicleInfo?.make} ${this.customAlertData?.vehicleInfo?.model}`;
|
||||
// eslint-disable-next-line max-len
|
||||
const vinYmmExpected = `${this.mainStore.order.vehicle.year} ${this.mainStore.order.vehicle.make} ${this.mainStore.order.vehicle.model}`;
|
||||
return (vinYmmFound.toLowerCase() === vinYmmExpected.toLowerCase());
|
||||
return (vinYmmFound.toLowerCase() == vinYmmExpected.toLowerCase());
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
customerQuestions: {
|
||||
handler() {
|
||||
// if they modify one of the lookup fields (address, city, state, zipCode, or lastName),
|
||||
// then modify the button text back to "Get my personalized quote"
|
||||
// if they modify one of the lookup fields (address, city, state, zipCode, or lastName), then modify the button text back to "Get my personalized quote"
|
||||
this.$refs.siteFooter.updateButtonText(this.getCmsContent('siteFooterWidget', 'ForwardButtonText'));
|
||||
this.resetWarningsAndErrors();
|
||||
},
|
||||
|
|
@ -263,9 +258,7 @@ export default {
|
|||
this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId(carFound.carId);
|
||||
|
||||
// Update button "Continue with..."
|
||||
this.$refs.siteFooter
|
||||
// eslint-disable-next-line max-len
|
||||
.updateButtonText(`Continue with ${carFound.year} ${carFound.make} ${carFound.model} ${this.forwardButtonCarStyle}`);
|
||||
this.$refs.siteFooter.updateButtonText(`Continue with ${carFound.year} ${carFound.make} ${carFound.model} ${this.forwardButtonCarStyle}`);
|
||||
return this.$refs.siteFooter.removeLoader();
|
||||
}
|
||||
|
||||
|
|
@ -311,8 +304,7 @@ export default {
|
|||
// Match vehicles found to vehicles in state.
|
||||
const matchingCars = carsFound.filter((car) => car.vehicle.carId === useMainStore().order.vehicle.carId);
|
||||
|
||||
// If a different vehicle is found than the one entered
|
||||
// and the selected glass is not available for that vehicle then navigate back to "vehicle-damage"
|
||||
// If a different vehicle is found than the one entered and the selected glass is not available for that vehicle then navigate back to "vehicle-damage"
|
||||
// display vehicle changed alert on that page.
|
||||
if (
|
||||
this.isCarIdDifferent
|
||||
|
|
|
|||
|
|
@ -55,14 +55,13 @@ export default {
|
|||
displayMatchedDifferentVehicleAlert: Boolean,
|
||||
displayMatchedTwoIdenticalYMMVehicleAlert: Boolean
|
||||
},
|
||||
emits: ['update:modelValue'],
|
||||
emits: ['update: modelValue'],
|
||||
computed: {
|
||||
differentVehicleAlertHeader() {
|
||||
return this.getCmsContent('AlertMatchedDifferentVehicleWidget', 'HeadlineText').replaceAll('{custom:damage}',
|
||||
getDamageString());
|
||||
},
|
||||
differentVehicleAlertBody() {
|
||||
// eslint-disable-next-line max-len
|
||||
const vinYmmFound = `${this.selectedVehicle?.vehicle.year} ${this.selectedVehicle?.vehicle.make} ${this.selectedVehicle?.vehicle.model}`;
|
||||
const vinYmmExpected = `${this.vehicleSelected?.year} ${this.vehicleSelected?.make} ${this.vehicleSelected?.model}`;
|
||||
|
||||
|
|
@ -76,9 +75,7 @@ export default {
|
|||
'HeadlineText').replaceAll('{custom:damage}', getDamageString());
|
||||
},
|
||||
AlertMatchedTwoIdenticalYMMVehicleBody() {
|
||||
// eslint-disable-next-line max-len
|
||||
const vinYmmsFound = `${this.selectedVehicle?.vehicle.year} ${this.selectedVehicle?.vehicle.make} ${this.selectedVehicle?.vehicle.model} ${this.selectedVehicle?.vehicle.style}`;
|
||||
// eslint-disable-next-line max-len
|
||||
const vinYmmsExpected = `${this.vehicleSelected?.year} ${this.vehicleSelected?.make} ${this.vehicleSelected?.model} ${this.vehicleSelected?.style}`;
|
||||
|
||||
return this.getCmsContent('AlertMatchedTwoIdenticalYMMVehicleWidget', 'BodyText')
|
||||
|
|
@ -101,7 +98,6 @@ export default {
|
|||
// this computed is only needed for the computed differentVehicleAlertBody text above
|
||||
return this.vehicles.find(({ vin }) => vin === this.selectedVehicleVin);
|
||||
},
|
||||
// TODO: Fix duplicated key
|
||||
vehicleSelected() {
|
||||
return this.vehicleSelected;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import addressVehicles from '@/layouts/address-vehicles/address-vehicles';
|
||||
import settleAllPromises from '@/helpers/layout-helper.js';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper.js';
|
||||
import { shallowMount } from '@vue/test-utils';
|
||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||
import { useMainStore } from '@/store';
|
||||
|
|
@ -21,7 +21,9 @@ jest.mock('@/helpers/cms-content-helper', () => ({
|
|||
}));
|
||||
|
||||
// Mock our module for promises.
|
||||
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
|
||||
jest.mock('@/helpers/layout-helper.js', () => ({
|
||||
settleAllPromises: jest.fn()
|
||||
}));
|
||||
|
||||
function setupMocks({
|
||||
route = null,
|
||||
|
|
@ -161,8 +163,7 @@ describe('address-vehicles.vue', () => {
|
|||
expect(wrapper.vm.navigateForward).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
// TODO: Test needs to be fixed
|
||||
test.skip('Should return out of forwardButtonAction is lookupVin returns an error', async () => {
|
||||
test('Should return out of forwardButtonAction is lookupVin returns an error', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
wrapper.vm.navigateForwardWithSingleCarMatch = jest.fn();
|
||||
|
|
@ -186,7 +187,7 @@ describe('address-vehicles.vue', () => {
|
|||
wrapper.vm.$nextTick();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.forwardButtonAction).toReturn();
|
||||
expect(wrapper.vm.forwardButtonAction).toReturn;
|
||||
});
|
||||
|
||||
test('Should navigate to CLICKED_FORWARD scenario if carId is different and selected glass not available for vehicle on navigateForward', async () => {
|
||||
|
|
|
|||
|
|
@ -65,10 +65,10 @@
|
|||
|
||||
<script>
|
||||
// Import Supporting Files
|
||||
import settleAllPromises from '@/helpers/layout-helper';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper';
|
||||
import { useMainStore } from '@/store';
|
||||
import issPageValues from '@/router/router-constants/issPage-values';
|
||||
import errorMessages from '@/constants/error-messages';
|
||||
import { issPageValues } from '@/router/router-constants/issPage-values';
|
||||
import { errorMessages } from '@/constants/error-messages';
|
||||
import { required } from '@/helpers/validation-rules';
|
||||
import { Form, defineRule } from 'vee-validate';
|
||||
import { isGlassAvailableForCarId } from '@/helpers/damage-helper';
|
||||
|
|
@ -79,7 +79,7 @@ import {
|
|||
getRouterLinkRouteFromCopy,
|
||||
getRouterLinkDisplayTextFromCopy
|
||||
} from '@/helpers/cms-content-helper.js';
|
||||
import routerParams from '@/router/router-constants/router-params';
|
||||
import { routerParams } from '@/router/router-constants/router-params';
|
||||
import vinPagesMixin from '@/mixins/vin-pages-mixin';
|
||||
|
||||
// Import Component
|
||||
|
|
@ -152,9 +152,7 @@ export default {
|
|||
'HeadlineText').replaceAll('{custom:vehicleCount}', this.vehicleCount);
|
||||
},
|
||||
isTwoIdenticalYMMVehicleFound() {
|
||||
// eslint-disable-next-line max-len
|
||||
const vinYmmFound = `${this.selectedVehicle?.vehicle.year} ${this.selectedVehicle?.vehicle.make} ${this.selectedVehicle?.vehicle.model}`;
|
||||
// eslint-disable-next-line max-len
|
||||
const vinYmmExpected = `${this.mainStore.order.vehicle.year} ${this.mainStore.order.vehicle.make} ${this.mainStore.order.vehicle.model}`;
|
||||
return (vinYmmFound.toLowerCase() === vinYmmExpected.toLowerCase());
|
||||
},
|
||||
|
|
@ -162,8 +160,7 @@ export default {
|
|||
return this.getCmsContent('ProvideVinAlert', 'BodyText');
|
||||
},
|
||||
splitAlertProvideVinBodyForLink() {
|
||||
// Splits content when brackets are found in text so that text can be
|
||||
// looped through and router - link can be injected when needed
|
||||
// Splits content when brackets are found in text so that text can be looped through and router-link can be injected when needed
|
||||
return this.splitCopyOnCMSPlaceHolder(this.AlertProvideVinBody);
|
||||
},
|
||||
VehiclesForQuestions() {
|
||||
|
|
@ -209,7 +206,6 @@ export default {
|
|||
} else {
|
||||
this.displayMatchedDifferentVehicleAlert = true;
|
||||
}
|
||||
// eslint-disable-next-line max-len
|
||||
this.$refs.siteFooter.updateButtonText(`Continue with ${this.selectedVehicle.vehicle.year} ${this.selectedVehicle.vehicle.make} ${this.selectedVehicle.vehicle.model} ${this.forwardButtonCarStyle}`);
|
||||
} else {
|
||||
this.$refs.siteFooter.updateButtonText(this.getCmsContent('SiteFooterWidget', 'ForwardButtonText'));
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
ref="theForm"
|
||||
v-slot="{ meta }"
|
||||
@submit="onSubmit"
|
||||
@invalidSubmit="onInvalidSubmit">
|
||||
@invalid-submit="onInvalidSubmit">
|
||||
<div class="page-container-grouped-styles">
|
||||
<div class="fade-on-route-transition position-relative">
|
||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
cmsWidgetName="SiteFooterWidget"
|
||||
:isForwardActionDisabled="!meta.valid"
|
||||
@ForwardClicked="forwardButtonAction"
|
||||
@backClicked="backButtonAction" />
|
||||
@back-clicked="backButtonAction" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -26,7 +26,7 @@ import siteHeader from '@/iss-components/site-header/site-header';
|
|||
import siteFooter from '@/iss-components/site-footer/site-footer';
|
||||
// Supporting files
|
||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||
import settleAllPromises from '@/helpers/layout-helper';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper';
|
||||
import { Form } from 'vee-validate';
|
||||
import BaseFormMixin from '@/mixins/base-form-mixin.js';
|
||||
import { useMainStore } from '@/store';
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@ import { nextTick } from 'vue';
|
|||
import baseMixin from '@/mixins/base-mixin';
|
||||
|
||||
// Mock our module for promises.
|
||||
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
|
||||
jest.mock('@/helpers/layout-helper.js', () => ({
|
||||
settleAllPromises: jest.fn()
|
||||
}));
|
||||
|
||||
// Mock fetchCmsContentForPage
|
||||
jest.mock('@/helpers/cms-content-helper', () => ({
|
||||
|
|
@ -29,8 +31,7 @@ const baseStoreGettersPageData = () => ({
|
|||
{
|
||||
questionSequence: 1,
|
||||
questionText:
|
||||
'Is your vehicle equipped with the optional Lane-Keeping System which tugs'
|
||||
+ ' on the steering wheel and/or beeps to alert you if you drift too close to the edge of the lane?',
|
||||
'Is your vehicle equipped with the optional Lane-Keeping System which tugs on the steering wheel and/or beeps to alert you if you drift too close to the edge of the lane?',
|
||||
answers: [
|
||||
{
|
||||
answerResult1: 'DYNAMIC',
|
||||
|
|
@ -67,16 +68,14 @@ const baseStoreGettersDamage = () => ({
|
|||
answeredQuestions: [
|
||||
{
|
||||
questionText:
|
||||
'Is your vehicle equipped with the Panoramic Sunroof which can be identified'
|
||||
+ ' by having a glass panel over the rear seats?',
|
||||
'Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?',
|
||||
selectedAnswer: '1|nextQuestion|3|Yes',
|
||||
selectedAnswerText: 'Yes',
|
||||
questionNum: 1
|
||||
},
|
||||
{
|
||||
questionText:
|
||||
'Is your vehicle equipped with a heated windshield that melts snow and'
|
||||
+ ' ice from underneath the windshield wiper blades?',
|
||||
'Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?',
|
||||
selectedAnswer: '2|nextQuestion|3|Yes',
|
||||
selectedAnswerText: 'Yes',
|
||||
questionNum: 2
|
||||
|
|
@ -212,16 +211,14 @@ describe('capabilityQuestions.vue', () => {
|
|||
answeredQuestions: [
|
||||
{
|
||||
questionText:
|
||||
'Is your vehicle equipped with the Panoramic Sunroof which can be'
|
||||
+ ' identified by having a glass panel over the rear seats?',
|
||||
'Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?',
|
||||
selectedAnswer: '1|nextQuestion|3|Yes',
|
||||
selectedAnswerText: 'Yes',
|
||||
questionNum: 1
|
||||
},
|
||||
{
|
||||
questionText:
|
||||
'Is your vehicle equipped with a heated windshield that melts snow'
|
||||
+ ' and ice from underneath the windshield wiper blades?',
|
||||
'Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?',
|
||||
selectedAnswer: '2|nextQuestion|3|Yes',
|
||||
selectedAnswerText: 'Yes',
|
||||
questionNum: 2
|
||||
|
|
@ -275,8 +272,7 @@ describe('capabilityQuestions.vue', () => {
|
|||
wrapper.unmount();
|
||||
});
|
||||
|
||||
// TODO: Test needs to be fixed
|
||||
test.skip('Should save to pinia store', async () => {
|
||||
test('Should save to pinia store', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
|
||||
|
|
@ -308,12 +304,10 @@ describe('capabilityQuestions.vue', () => {
|
|||
await nextTick();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.saveCapabilityQuestionAnswers).toHaveBeenCalled();
|
||||
expect(wrapper.vm.saveCapabilityQuestionAnswers).toHaveBeenCalled;
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
// TODO: Test needs fixup
|
||||
test.skip('Should call GET_PART_FROM_CAPABILITY_QUESTION_ANSWER API', async () => {
|
||||
test('Should call GET_PART_FROM_CAPABILITY_QUESTION_ANSWER API', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
|
||||
|
|
@ -343,7 +337,7 @@ describe('capabilityQuestions.vue', () => {
|
|||
await nextTick();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.getPartFromCapabilityQuestionAnswer).toHaveBeenCalled();
|
||||
expect(wrapper.vm.getPartFromCapabilityQuestionAnswer).toHaveBeenCalled;
|
||||
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -15,17 +15,17 @@
|
|||
:validationRules="rules.optionRequired"
|
||||
:index="currentGlassIndex"
|
||||
@forwardButtonAction="forwardButtonAction"
|
||||
@backClick="navigateBack" />
|
||||
@back-click="navigateBack" />
|
||||
</Form>
|
||||
</template>
|
||||
<script>
|
||||
// Import Supporting Files
|
||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||
import settleAllPromises from '@/helpers/layout-helper';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper';
|
||||
|
||||
// Import Component
|
||||
import baseFormMixin from '@/mixins/base-form-mixin';
|
||||
import issPageValues from '@/router/router-constants/issPage-values';
|
||||
import { issPageValues } from '@/router/router-constants/issPage-values';
|
||||
import { Form } from 'vee-validate';
|
||||
import { useMainStore } from '@/store';
|
||||
import globalRules from '@/constants/global-rules';
|
||||
|
|
@ -97,7 +97,6 @@ export default {
|
|||
.filter((x) => x.capabilityQuestions)
|
||||
.map((glass, index) => {
|
||||
// NOTE: questions for property "questions" can differ between layouts
|
||||
// TODO: Assignment to property
|
||||
glass.questions = glass.capabilityQuestions;
|
||||
glass.answerKey = `${glass.glassLocation}-${glass.glassName}`;
|
||||
// reset selectedAnswers for this glass
|
||||
|
|
@ -144,7 +143,6 @@ export default {
|
|||
await this.mainStore.saveCapabilityQuestionAnswers(questionAnswersArray);
|
||||
// get parts from the capabilityQuestionAnswers
|
||||
const partsOrQuestions = this.partsOrQuestionsData;
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const answer of questionAnswersArray) {
|
||||
partsOrQuestions.find((partOrQuestion) => (
|
||||
partOrQuestion.glassLocation === answer.glassLocation
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { shallowMount } from '@vue/test-utils';
|
|||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||
import { getRandomString, getRandomInt, getRandomBoolean } from '@/helpers/data-generation.js';
|
||||
import { createTestingPinia } from '@pinia/testing';
|
||||
import navigationScenarios from '@/router/router-constants/navigation-scenarios.js';
|
||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios.js';
|
||||
import { useMainStore } from '@/store/index.js';
|
||||
|
||||
describe('contactDetails.vue', () => {
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@
|
|||
|
||||
<siteFooter
|
||||
ref="siteFooter"
|
||||
class="my-6"
|
||||
class="my-5"
|
||||
:cmsWidgetName="widget.siteFooter"
|
||||
:isForwardActionDisabled="!meta.valid"
|
||||
@forwardClicked="forwardButtonAction"
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ import loadingModal from '@/iss-components/loading-modal/loading-modal';
|
|||
|
||||
// Import Supporting Files
|
||||
import { fetchCmsContentForPage, setupModalLinks, processIfStatements } from '@/helpers/cms-content-helper.js';
|
||||
import settleAllPromises from '@/helpers/layout-helper.js';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper.js';
|
||||
import { getDamageString } from '@/helpers/damage-helper.js';
|
||||
import { useMainStore } from '@/store/index.js';
|
||||
import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin.js';
|
||||
|
|
@ -163,7 +163,6 @@ export default {
|
|||
const pricingResults = await useMainStore().getPriceOrderItems(availableLineItems);
|
||||
|
||||
// Call the "next" function to complete the transition to this page.
|
||||
// TODO: Assignment to parm
|
||||
next((vm) => {
|
||||
vm.setCmsContent(resultMap.cmsContent);
|
||||
vm.availableLineItems = pricingResults;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
:ref="ModalName"
|
||||
:modalId="ModalName"
|
||||
:footerButtonText="ModalCloseButtonText"
|
||||
@footerButtonEvent="closeModal">
|
||||
@footer-button-event="closeModal">
|
||||
<div class="recal-modal-body ps-4 pe-4 pt-0 pb-5">
|
||||
<h5
|
||||
class="mb-4 text-center"
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@
|
|||
import entryPage from '@/layouts/entry-page/entry-page';
|
||||
|
||||
import { shallowMount } from '@vue/test-utils';
|
||||
import settleAllPromises from '@/helpers/layout-helper.js';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper.js';
|
||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||
|
||||
// Mock our module for promises.
|
||||
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
|
||||
jest.mock('@/helpers/layout-helper.js', () => ({
|
||||
settleAllPromises: jest.fn()
|
||||
}));
|
||||
|
||||
// Mock fetchCmsContentForPage
|
||||
jest.mock('@/helpers/cms-content-helper', () => ({
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
<script>
|
||||
// Supporting files
|
||||
import issPageValues from '@/router/router-constants/issPage-values';
|
||||
import validateISSClientTag from '@/helpers/clientauth-helper';
|
||||
import { issPageValues } from '@/router/router-constants/issPage-values';
|
||||
import { validateISSClientTag } from '@/helpers/clientauth-helper';
|
||||
import { useMainStore } from '@/store';
|
||||
|
||||
export default {
|
||||
|
|
@ -42,7 +42,6 @@ export default {
|
|||
parseQueryParms() {
|
||||
// Dump the query string parameters into an array. Remove casing on the key for easy compare.
|
||||
const queryStringParams = [];
|
||||
// TODO: This should be changed to Object.keys/values or whatever
|
||||
for (const param in this.$route.query) {
|
||||
queryStringParams[param.toLowerCase()] = this.$route.query[param];
|
||||
}
|
||||
|
|
@ -112,10 +111,10 @@ export default {
|
|||
|
||||
try {
|
||||
const clientParams = JSON.parse(configParams);
|
||||
// TODO: This should be changed to Object.keys/values or whatever
|
||||
|
||||
for (const cparam in clientParams) {
|
||||
const cname = clientParams[cparam].toLowerCase();
|
||||
// TODO: This should be changed to Object.keys/values or whatever
|
||||
|
||||
for (const qsparam in queryStringParams) {
|
||||
const qsname = qsparam.toLowerCase();
|
||||
|
||||
|
|
@ -132,7 +131,6 @@ export default {
|
|||
},
|
||||
populateStoreItemsFromParams(params) {
|
||||
// Populate store items from parameters.
|
||||
// TODO: This should be changed to Object.keys/values or whatever
|
||||
for (const param in params) {
|
||||
const name = param.toLowerCase();
|
||||
const value = params[param];
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
import licensePlateLookup from '@/layouts/license-plate-lookup/license-plate-lookup';
|
||||
|
||||
// Supporting Files
|
||||
import settleAllPromises from '@/helpers/layout-helper.js';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper.js';
|
||||
import { shallowMount } from '@vue/test-utils';
|
||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||
import { useMainStore } from '@/store';
|
||||
import navigationScenarios from '@/router/router-constants/navigation-scenarios';
|
||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
|
||||
|
||||
jest.mock('@/helpers/damage-helper', () => ({
|
||||
isGlassAvailableForCarId: jest.fn().mockImplementation(() => true),
|
||||
|
|
@ -14,7 +14,9 @@ jest.mock('@/helpers/damage-helper', () => ({
|
|||
}));
|
||||
|
||||
// Mock our module for promises.
|
||||
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
|
||||
jest.mock('@/helpers/layout-helper.js', () => ({
|
||||
settleAllPromises: jest.fn()
|
||||
}));
|
||||
|
||||
// Mock fetchCmsContentForPage
|
||||
jest.mock('@/helpers/cms-content-helper', () => ({
|
||||
|
|
@ -208,7 +210,6 @@ describe('license-plate-lookup.vue', () => {
|
|||
expect(wrapper.vm.navigateForwardWithSingleCarMatch).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
test('if a different vehicle is found than the one entered and the selected glass is not available for that vehicle, navigate back to vehicle-damage page', async () => {
|
||||
// Arrange
|
||||
const mockRegistrationLicensePlate = {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
ref="theForm"
|
||||
v-slot="{ meta }"
|
||||
@submit="onSubmit"
|
||||
@invalidSubmit="onInvalidSubmit">
|
||||
@invalid-submit="onInvalidSubmit">
|
||||
<div class="page-container-grouped-styles">
|
||||
<div class="fade-on-route-transition position-relative">
|
||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||
|
|
@ -64,8 +64,8 @@
|
|||
class="mt-5"
|
||||
:isForwardActionDisabled="!meta.valid"
|
||||
cmsWidgetName="SiteFooterWidget"
|
||||
@backClicked="backButtonAction"
|
||||
@forwardClicked="forwardButtonAction" />
|
||||
@back-clicked="backButtonAction"
|
||||
@forward-clicked="forwardButtonAction" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -78,14 +78,14 @@
|
|||
<script>
|
||||
// Import Supporting Files
|
||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||
import settleAllPromises from '@/helpers/layout-helper';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper';
|
||||
import { useMainStore } from '@/store';
|
||||
import errorMessages from '@/constants/error-messages';
|
||||
import { errorMessages } from '@/constants/error-messages';
|
||||
import { required } from '@/helpers/validation-rules';
|
||||
import { defineRule, Form } from 'vee-validate';
|
||||
import { getDamageString, isGlassAvailableForCarId } from '@/helpers/damage-helper.js';
|
||||
import routerParams from '@/router/router-params.js';
|
||||
import states from '@/constants/states';
|
||||
import { routerParams } from '@/router/router-params.js';
|
||||
import { states } from '@/constants/states';
|
||||
|
||||
// Import Component
|
||||
import baseFormMixin from '@/mixins/base-form-mixin';
|
||||
|
|
@ -158,9 +158,7 @@ export default {
|
|||
'HeadlineText').replaceAll('{custom:damage}', getDamageString());
|
||||
},
|
||||
AlertMatchedDifferentVehicleBody() {
|
||||
// eslint-disable-next-line max-len
|
||||
const vinYmmFound = `${this.customAlertData?.vehicleInfo?.year} ${this.customAlertData?.vehicleInfo?.make} ${this.customAlertData?.vehicleInfo?.model}`;
|
||||
// eslint-disable-next-line max-len
|
||||
const vinYmmExpected = `${this.mainStore.order.vehicle.year} ${this.mainStore.order.vehicle.make} ${this.mainStore.order.vehicle.model}`;
|
||||
|
||||
return this.getCmsContent('AlertMatchedDifferentVehicleWidget', 'BodyText')
|
||||
|
|
@ -173,9 +171,7 @@ export default {
|
|||
'HeadlineText').replaceAll('{custom:damage}', getDamageString());
|
||||
},
|
||||
AlertMatchedTwoIdenticalYMMVehicleBody() {
|
||||
// eslint-disable-next-line max-len
|
||||
const vinYmmsFound = `${this.customAlertData?.vehicleInfo?.year} ${this.customAlertData?.vehicleInfo?.make} ${this.customAlertData?.vehicleInfo?.model} ${this.customAlertData?.vehicleInfo?.style}`;
|
||||
// eslint-disable-next-line max-len
|
||||
const vinYmmsExpected = `${this.mainStore.order.vehicle.year} ${this.mainStore.order.vehicle.make} ${this.mainStore.order.vehicle.model} ${this.mainStore.order.vehicle.style}`;
|
||||
|
||||
return this.getCmsContent('AlertMatchedTwoIdenticalYMMVehicleWidget', 'BodyText')
|
||||
|
|
@ -184,9 +180,7 @@ export default {
|
|||
.replaceAll('{custom:vinYmmsExpected}', vinYmmsExpected);
|
||||
},
|
||||
isTwoIdenticalYMMVehicleFound() {
|
||||
// eslint-disable-next-line max-len
|
||||
const vinYmmFound = `${this.customAlertData?.vehicleInfo?.year} ${this.customAlertData?.vehicleInfo?.make} ${this.customAlertData?.vehicleInfo?.model}`;
|
||||
// eslint-disable-next-line max-len
|
||||
const vinYmmExpected = `${this.mainStore.order.vehicle.year} ${this.mainStore.order.vehicle.make} ${this.mainStore.order.vehicle.model}`;
|
||||
return (vinYmmFound.toLowerCase() === vinYmmExpected.toLowerCase());
|
||||
},
|
||||
|
|
@ -276,7 +270,6 @@ export default {
|
|||
this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId(vehicleFromLookup.carId);
|
||||
|
||||
// Update button "Continue with..."
|
||||
// eslint-disable-next-line max-len
|
||||
this.$refs.siteFooter.updateButtonText(`Continue with ${vehicleFromLookup.year} ${vehicleFromLookup.make} ${vehicleFromLookup.model} ${this.forwardButtonCarStyle}`);
|
||||
return this.$refs.siteFooter.removeLoader();
|
||||
}
|
||||
|
|
@ -295,8 +288,7 @@ export default {
|
|||
return await this.navigateForward();
|
||||
},
|
||||
async navigateForward() {
|
||||
// If a different vehicle is found than the one entered
|
||||
// and the selected glass is not available for that vehicle then navigate back to "vehicle-damage"
|
||||
// If a different vehicle is found than the one entered and the selected glass is not available for that vehicle then navigate back to "vehicle-damage"
|
||||
// display vehicle changed alert on that page.
|
||||
if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) {
|
||||
this.$router.navigate(this.navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@ import { nextTick } from 'vue';
|
|||
import baseMixin from '@/mixins/base-mixin';
|
||||
|
||||
// Mock our module for promises.
|
||||
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
|
||||
jest.mock('@/helpers/layout-helper.js', () => ({
|
||||
settleAllPromises: jest.fn()
|
||||
}));
|
||||
|
||||
// Mock fetchCmsContentForPage
|
||||
jest.mock('@/helpers/cms-content-helper', () => ({
|
||||
|
|
@ -131,16 +133,14 @@ const baseStoreGettersDamage = () => ({
|
|||
answeredQuestions: [
|
||||
{
|
||||
questionText:
|
||||
'Is your vehicle equipped with the Panoramic Sunroof which can be'
|
||||
+ ' identified by having a glass panel over the rear seats?',
|
||||
'Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?',
|
||||
selectedAnswer: '1|nextQuestion|3|Yes',
|
||||
selectedAnswerText: 'Yes',
|
||||
questionNum: 1
|
||||
},
|
||||
{
|
||||
questionText:
|
||||
'Is your vehicle equipped with a heated windshield that melts'
|
||||
+ ' snow and ice from underneath the windshield wiper blades?',
|
||||
'Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?',
|
||||
selectedAnswer: '2|nextQuestion|3|Yes',
|
||||
selectedAnswerText: 'Yes',
|
||||
questionNum: 2
|
||||
|
|
@ -218,16 +218,14 @@ describe('moldingQuestions.vue', () => {
|
|||
answeredQuestions: [
|
||||
{
|
||||
questionText:
|
||||
'Is your vehicle equipped with the Panoramic Sunroof which can'
|
||||
+ ' be identified by having a glass panel over the rear seats?',
|
||||
'Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?',
|
||||
selectedAnswer: '1|nextQuestion|3|Yes',
|
||||
selectedAnswerText: 'Yes',
|
||||
questionNum: 1
|
||||
},
|
||||
{
|
||||
questionText:
|
||||
'Is your vehicle equipped with a heated windshield that melts'
|
||||
+ ' snow and ice from underneath the windshield wiper blades?',
|
||||
'Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?',
|
||||
selectedAnswer: '2|nextQuestion|3|Yes',
|
||||
selectedAnswerText: 'Yes',
|
||||
questionNum: 2
|
||||
|
|
@ -277,8 +275,7 @@ describe('moldingQuestions.vue', () => {
|
|||
wrapper.unmount();
|
||||
});
|
||||
|
||||
// TODO: Test needs fixup
|
||||
test.skip('Should save to pinia store', async () => {
|
||||
test('Should save to pinia store', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
|
||||
|
|
@ -304,12 +301,11 @@ describe('moldingQuestions.vue', () => {
|
|||
await nextTick();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.saveMoldingQuestionAnswers).toHaveBeenCalled();
|
||||
expect(wrapper.vm.saveMoldingQuestionAnswers).toHaveBeenCalled;
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
// TODO: Test needs fixup
|
||||
test.skip('Should call GET_PARTS_OR_QUESTIONS API', async () => {
|
||||
test('Should call GET_PARTS_OR_QUESTIONS API', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
|
||||
|
|
@ -335,7 +331,7 @@ describe('moldingQuestions.vue', () => {
|
|||
await nextTick();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.getPartsOrQuestions).toHaveBeenCalled();
|
||||
expect(wrapper.vm.getPartsOrQuestions).toHaveBeenCalled;
|
||||
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,17 +16,17 @@
|
|||
:validationRules="rules.optionRequired"
|
||||
:index="currentGlassIndex"
|
||||
@forwardButtonAction="forwardButtonAction"
|
||||
@backClick="navigateBack" />
|
||||
@back-click="navigateBack" />
|
||||
</Form>
|
||||
</template>
|
||||
<script>
|
||||
// Import Supporting Files
|
||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||
import settleAllPromises from '@/helpers/layout-helper';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper';
|
||||
import globalRules from '@/constants/global-rules';
|
||||
import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin';
|
||||
import { useMainStore } from '@/store';
|
||||
import issPageValues from '@/router/router-constants/issPage-values';
|
||||
import { issPageValues } from '@/router/router-constants/issPage-values';
|
||||
import BaseFormMixin from '@/mixins/base-form-mixin.js';
|
||||
|
||||
// Import Component
|
||||
|
|
@ -101,7 +101,6 @@ export default {
|
|||
.filter((x) => x.parts[0].childPartQuestions.length)
|
||||
.map((glass, index) => {
|
||||
// NOTE: questions for property "questions" can differ between layouts
|
||||
// TODO: Assignment to property
|
||||
glass.questions = glass.parts[0].childPartQuestions;
|
||||
glass.answerKey = `${glass.glassLocation}-${glass.glassName}`;
|
||||
// reset selectedAnswers for this glass
|
||||
|
|
@ -131,7 +130,6 @@ export default {
|
|||
}));
|
||||
// clear out answerData for future page loads; must occur prior to store save
|
||||
this.questionsData.forEach((glass) => {
|
||||
// TODO: Assignment to property
|
||||
glass.answerData = {};
|
||||
});
|
||||
// save to store as order.damage.moldingQuestionArrays (array)
|
||||
|
|
@ -139,7 +137,6 @@ export default {
|
|||
|
||||
// get parts from the questionAnswers
|
||||
const partsOrQuestions = this.partsOrQuestionsData;
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const answer of questionAnswersArray) {
|
||||
partsOrQuestions.find((partOrQuestion) => (
|
||||
partOrQuestion.glassLocation === answer.glassLocation
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
ref="theForm"
|
||||
v-slot="{ meta }"
|
||||
@submit="onSubmit"
|
||||
@invalidSubmit="onInvalidSubmit">
|
||||
@invalid-submit="onInvalidSubmit">
|
||||
<div class="page-container-grouped-styles">
|
||||
<div class="fade-on-route-transition position-relative">
|
||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
cmsWidgetName="SiteFooterWidget"
|
||||
:isForwardActionDisabled="!meta.valid"
|
||||
@ForwardClicked="forwardButtonAction"
|
||||
@backClicked="backButtonAction" />
|
||||
@back-clicked="backButtonAction" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -26,7 +26,7 @@ import siteHeader from '@/iss-components/site-header/site-header';
|
|||
import siteFooter from '@/iss-components/site-footer/site-footer';
|
||||
// Supporting files
|
||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||
import settleAllPromises from '@/helpers/layout-helper';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper';
|
||||
import { Form } from 'vee-validate';
|
||||
import BaseFormMixin from '@/mixins/base-form-mixin.js';
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@ import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin';
|
|||
import { nextTick } from 'vue';
|
||||
|
||||
// Mock our module for promises.
|
||||
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
|
||||
jest.mock('@/helpers/layout-helper.js', () => ({
|
||||
settleAllPromises: jest.fn()
|
||||
}));
|
||||
|
||||
// Mock fetchCmsContentForPage
|
||||
jest.mock('@/helpers/cms-content-helper', () => ({
|
||||
|
|
@ -88,8 +90,7 @@ const baseStoreGettersPageData = () => ({
|
|||
{
|
||||
questionSequence: 1,
|
||||
questionText:
|
||||
'Is your vehicle equipped with the Panoramic Sunroof which can be'
|
||||
+ ' identified by having a glass panel over the rear seats?',
|
||||
'Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?',
|
||||
answers: [
|
||||
{
|
||||
answerResult: '',
|
||||
|
|
@ -120,15 +121,13 @@ const baseStoreGettersDamage = () => ({
|
|||
answeredQuestions: [
|
||||
{
|
||||
questionText:
|
||||
'Is your vehicle equipped with the Panoramic Sunroof which'
|
||||
+ ' can be identified by having a glass panel over the rear seats?',
|
||||
'Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?',
|
||||
selectedAnswerText: 'Yes',
|
||||
questionNum: 1
|
||||
},
|
||||
{
|
||||
questionText:
|
||||
'Is your vehicle equipped with a heated windshield that melts'
|
||||
+ ' snow and ice from underneath the windshield wiper blades?',
|
||||
'Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?',
|
||||
selectedAnswerText: 'Yes',
|
||||
questionNum: 2
|
||||
}
|
||||
|
|
@ -284,8 +283,7 @@ describe('partQuestions.vue...', () => {
|
|||
wrapper.unmount();
|
||||
});
|
||||
|
||||
// TODO: Test needs fixup
|
||||
test.skip('Should save to pinia store', async () => {
|
||||
test('Should save to pinia store', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
|
||||
|
|
@ -312,12 +310,11 @@ describe('partQuestions.vue...', () => {
|
|||
await nextTick();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.savePartQuestionAnswers).toHaveBeenCalled();
|
||||
expect(wrapper.vm.savePartQuestionAnswers).toHaveBeenCalled;
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
// TODO: Test needs to be fixed up
|
||||
test.skip('Should call GET_PARTS API', async () => {
|
||||
test('Should call GET_PARTS API', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
|
||||
|
|
@ -343,13 +340,12 @@ describe('partQuestions.vue...', () => {
|
|||
await nextTick();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.getParts).toHaveBeenCalled();
|
||||
expect(wrapper.vm.getParts).toHaveBeenCalled;
|
||||
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
// TODO: Test needs to be fixed up
|
||||
test.skip('Should trigger navigateForward', async () => {
|
||||
test('Should trigger navigateForward', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
ref="theForm"
|
||||
v-slot="{ meta }"
|
||||
@submit="onSubmit"
|
||||
@invalidSubmit="onInvalidSubmit">
|
||||
@invalid-submit="onInvalidSubmit">
|
||||
<questions-page-layout
|
||||
ref="questionsPageLayout"
|
||||
v-model="selectedAnswers"
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
:validationRules="rules.optionRequired"
|
||||
:index="currentGlassIndex"
|
||||
@forwardButtonAction="forwardButtonAction"
|
||||
@backClick="navigateBack" />
|
||||
@back-click="navigateBack" />
|
||||
</Form>
|
||||
</template>
|
||||
|
||||
|
|
@ -24,9 +24,9 @@ import questionsPageLayout from '@/iss-components/questions-page-layout/question
|
|||
|
||||
// Supporting Files
|
||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||
import settleAllPromises from '@/helpers/layout-helper';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper';
|
||||
import { useMainStore } from '@/store';
|
||||
import issPageValues from '@/router/router-constants/issPage-values';
|
||||
import { issPageValues } from '@/router/router-constants/issPage-values';
|
||||
import { Form } from 'vee-validate';
|
||||
import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin';
|
||||
import BaseFormMixin from '@/mixins/base-form-mixin.js';
|
||||
|
|
@ -35,7 +35,6 @@ import globalRules from '@/constants/global-rules';
|
|||
export default {
|
||||
name: 'part-questions',
|
||||
components: {
|
||||
// eslint-disable-next-line vue/no-reserved-component-names
|
||||
Form,
|
||||
questionsPageLayout
|
||||
},
|
||||
|
|
@ -88,7 +87,6 @@ export default {
|
|||
.filter((x) => x.partQuestions)
|
||||
.map((glass, index) => {
|
||||
// NOTE: questions for property "questions" can differ between layouts
|
||||
// TODO: Assignment to property
|
||||
glass.questions = glass.partQuestions;
|
||||
glass.answerKey = `${glass.glassLocation}-${glass.glassName}`;
|
||||
// reset selectedAnswers for this glass
|
||||
|
|
@ -127,7 +125,6 @@ export default {
|
|||
|
||||
// clear out answerData for future page loads; must occur prior to store save
|
||||
this.questionsData.forEach((glass) => {
|
||||
// TODO: Assignment to property
|
||||
if (glass.answerData) {
|
||||
glass.answerData = {};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
ref="theForm"
|
||||
v-slot="{ meta }"
|
||||
@submit="onSubmit"
|
||||
@invalidSubmit="onInvalidSubmit">
|
||||
@invalid-submit="onInvalidSubmit">
|
||||
<div class="page-container-grouped-styles">
|
||||
<div class="fade-on-route-transition position-relative">
|
||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
cmsWidgetName="SiteFooterWidget"
|
||||
:isForwardActionDisabled="!meta.valid"
|
||||
@ForwardClicked="forwardButtonAction"
|
||||
@backClicked="backButtonAction" />
|
||||
@back-clicked="backButtonAction" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -27,7 +27,7 @@ import siteFooter from '@/iss-components/site-footer/site-footer';
|
|||
|
||||
// Supporting files
|
||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||
import settleAllPromises from '@/helpers/layout-helper';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper';
|
||||
import { Form } from 'vee-validate';
|
||||
import BaseFormMixin from '@/mixins/base-form-mixin.js';
|
||||
import { useMainStore } from '@/store';
|
||||
|
|
@ -37,7 +37,6 @@ export default {
|
|||
components: {
|
||||
siteHeader,
|
||||
siteFooter,
|
||||
// eslint-disable-next-line vue/no-reserved-component-names
|
||||
Form
|
||||
},
|
||||
mixins: [BaseFormMixin],
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ import policyHolderDetails from '@/layouts/policy-holder-details/policy-holder-d
|
|||
// Supporting files
|
||||
// Supporting files
|
||||
import { shallowMount } from '@vue/test-utils';
|
||||
import settleAllPromises from '@/helpers/layout-helper.js';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper.js';
|
||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||
import { useMainStore } from '@/store';
|
||||
import navigationScenarios from '@/router/router-constants/navigation-scenarios';
|
||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
|
||||
|
||||
// Mock our module for promises.
|
||||
jest.mock('@/helpers/layout-helper.js', () => ({
|
||||
|
|
@ -67,8 +67,7 @@ function setupMocks() {
|
|||
return { wrapper };
|
||||
}
|
||||
|
||||
// TODO: Tests need fixup
|
||||
describe.skip('policy-holder-details.vue', () => {
|
||||
describe('policy-holder-details.vue', () => {
|
||||
test('Should render policy-holder-details sub-components (policy holder first name, last name, street address etc.)', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
|
|
@ -84,8 +83,7 @@ describe.skip('policy-holder-details.vue', () => {
|
|||
});
|
||||
});
|
||||
|
||||
// TODO: Tests need fixup
|
||||
describe.skip('navigation', () => {
|
||||
describe('navigation', () => {
|
||||
test('if the back button is clicked, navigate back', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
ref="theForm"
|
||||
v-slot="{ meta }"
|
||||
@submit="onSubmit"
|
||||
@invalidSubmit="onInvalidSubmit">
|
||||
@invalid-submit="onInvalidSubmit">
|
||||
<div class="page-container-grouped-styles">
|
||||
<div class="fade-on-route-transition position-relative">
|
||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
cmsWidgetName="SiteFooterWidget"
|
||||
:isForwardActionDisabled="!meta.valid"
|
||||
@ForwardClicked="forwardButtonAction"
|
||||
@backClicked="backButtonAction" />
|
||||
@back-clicked="backButtonAction" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -59,7 +59,7 @@ import siteFooter from '@/iss-components/site-footer/site-footer';
|
|||
|
||||
// Supporting files
|
||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||
import settleAllPromises from '@/helpers/layout-helper';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper';
|
||||
import { Form } from 'vee-validate';
|
||||
import globalRules from '@/constants/global-rules';
|
||||
import BaseFormMixin from '@/mixins/base-form-mixin.js';
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
import policyVehicles from '@/layouts/policy-vehicles/policy-vehicles';
|
||||
import settleAllPromises from '@/helpers/layout-helper';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper';
|
||||
import { shallowMount } from '@vue/test-utils';
|
||||
import { getMountOptions } from '@/helpers/unit-test-helper';
|
||||
import { useMainStore } from '@/store';
|
||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||
import navigationScenarios from '@/router/router-constants/navigation-scenarios';
|
||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
|
||||
import baseMixin from '@/mixins/base-mixin';
|
||||
import { getRandomString, getRandomInt } from '@/helpers/data-generation';
|
||||
import endorsementOptions from '@/constants/endorsement-options';
|
||||
import { endorsementOptions } from '@/constants/endorsement-options';
|
||||
import { createTestingPinia } from '@pinia/testing';
|
||||
import issPageValues from '@/router/router-constants/issPage-values';
|
||||
import vehicleSelectionOptions from '@/constants/vehicle-selection-options';
|
||||
import { issPageValues } from '@/router/router-constants/issPage-values';
|
||||
import { vehicleSelectionOptions } from '@/constants/vehicle-selection-options';
|
||||
|
||||
// Mock fetchCmsContentForPage
|
||||
jest.mock('@/helpers/cms-content-helper', () => ({
|
||||
|
|
@ -23,7 +23,9 @@ jest.mock('@/helpers/cms-content-helper', () => ({
|
|||
}));
|
||||
|
||||
// Mock our module for promises.
|
||||
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
|
||||
jest.mock('@/helpers/layout-helper.js', () => ({
|
||||
settleAllPromises: jest.fn()
|
||||
}));
|
||||
|
||||
const mockMixin = {
|
||||
methods: {
|
||||
|
|
@ -86,7 +88,6 @@ describe('policy-vehicles.vue', () => {
|
|||
});
|
||||
|
||||
describe('forwardButtonAction', () => {
|
||||
// eslint-disable-next-line max-len
|
||||
test('Selected VIN matches vehicle listed in system => update vehicle and navigate forward with CLICKED_FORWARD_LISTED_VEHICLE scenario.', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
|
|
@ -129,7 +130,6 @@ describe('policy-vehicles.vue', () => {
|
|||
{});
|
||||
});
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
test('Error in lookupVehicleByVin call => bailout true and navigate forward with CLICKED_FORWARD_WITH_BAILOUT scenario.', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ import policyVehiclesQuestion from '@/layouts/policy-vehicles/policy-vehicles-qu
|
|||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper.js';
|
||||
import { Form } from 'vee-validate';
|
||||
import BaseFormMixin from '@/mixins/base-form-mixin.js';
|
||||
import issPageValues from '@/router/router-constants/issPage-values.js';
|
||||
import vehicleSelectionOptions from '@/constants/vehicle-selection-options.js';
|
||||
import endorsementOptions from '@/constants/endorsement-options.js';
|
||||
import { issPageValues } from '@/router/router-constants/issPage-values.js';
|
||||
import { vehicleSelectionOptions } from '@/constants/vehicle-selection-options.js';
|
||||
import { endorsementOptions } from '@/constants/endorsement-options.js';
|
||||
import globalRules from '@/constants/global-rules.js';
|
||||
import { useMainStore } from '@/store/index.js';
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue