Merge branch 'develop' into feature/digital/SSR-639

This commit is contained in:
Katie Kroell 2023-08-15 14:04:10 -04:00
commit b1bb5b3588
72 changed files with 935 additions and 486 deletions

View file

@ -4,11 +4,12 @@ module.exports = {
jest: true jest: true
}, },
parserOptions: { parserOptions: {
ecmaVersion: 14 ecmaVersion: 'latest'
}, },
extends: [ extends: [
'eslint-config-airbnb-base', 'eslint-config-airbnb-base',
'plugin:vue/vue3-recommended' 'plugin:vue/vue3-recommended',
'plugin:jsdoc/recommended'
], ],
rules: { rules: {
'linebreak-style': 'off', 'linebreak-style': 'off',
@ -38,7 +39,7 @@ module.exports = {
svg: 'always', svg: 'always',
math: 'always' math: 'always'
}], }],
'import/extensions': ['error', 'always', { vue: 'never', js: 'ignorePackages' }] 'import/extensions': ['error', 'always', { js: 'ignorePackages' }]
}, },
settings: { settings: {
'import/resolver': { 'import/resolver': {

View file

@ -88,7 +88,12 @@ stages:
indexDeployVariables: indexDeployVariables:
__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__) __VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__)
__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__) __VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__)
cfDistributionId: $(cfDistributionId) - template: templates/digital/invalidate-cloudfront-cache.yml@AzureDevOps
parameters:
awsCliContainer: awscli
distributionId: $(cfDistributionId)
paths: /*
awsProfile: $(devDeploymentProfile)
# Test Build/Deploy # Test Build/Deploy
- stage: Test - stage: Test
@ -132,6 +137,12 @@ stages:
indexDeployVariables: indexDeployVariables:
__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__) __VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__)
__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__) __VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__)
- template: templates/digital/invalidate-cloudfront-cache.yml@AzureDevOps
parameters:
awsCliContainer: awscli
distributionId: $(cfDistributionId)
paths: /*
awsProfile: $(sysDeploymentProfile)
# QA Build/Deploy # QA Build/Deploy
- stage: QA - stage: QA
@ -184,7 +195,7 @@ stages:
# Prod Build/Deploy # Prod Build/Deploy
- stage: Prod - stage: Prod
condition: succeeded('Qa') condition: succeeded('QA')
variables: variables:
- group: ISS-Prod - group: ISS-Prod
jobs: jobs:

View file

@ -1,26 +1,26 @@
module.exports = { module.exports = {
verbose: true, verbose: true,
coverageReporters: ["html", "text", "cobertura"], coverageReporters: ['html', 'text', 'cobertura'],
reporters: ["default", "jest-junit"], reporters: ['default', 'jest-junit'],
testResultsProcessor: "jest-junit", testResultsProcessor: 'jest-junit',
preset: "@vue/cli-plugin-unit-jest", preset: '@vue/cli-plugin-unit-jest',
transform: { "^.+\\.vue$": "@vue/vue3-jest" }, transform: { '^.+\\.vue$': '@vue/vue3-jest' },
moduleFileExtensions: ["js", "vue"], moduleFileExtensions: ['js', 'vue'],
moduleNameMapper: { moduleNameMapper: {
axios: 'axios/dist/browser/axios.cjs' axios: 'axios/dist/browser/axios.cjs'
}, },
collectCoverageFrom: [ collectCoverageFrom: [
"src/**/*.{js,vue}", 'src/**/*.{js,vue}',
"!src/main.js", '!src/main.js',
"!src/constants/*.js", '!src/constants/*.js',
"!src/router/**/*.js", '!src/router/**/*.js',
"!src/helpers/unit-test-helper.js" '!src/helpers/unit-test-helper.js'
// END // END
], // ! means exclude from coverage. ], // ! means exclude from coverage.
testMatch: ["**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"], testMatch: ['**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)'],
coverageThreshold: { coverageThreshold: {
// global: { // global: {
// statements: 80, // statements: 80,
// }, // },
}, }
}; };

888
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -32,6 +32,8 @@
"@testing-library/jest-dom": "5.16.5", "@testing-library/jest-dom": "5.16.5",
"@testing-library/user-event": "14.4.3", "@testing-library/user-event": "14.4.3",
"@testing-library/vue": "6.6.1", "@testing-library/vue": "6.6.1",
"@vitejs/plugin-vue": "4.2.3",
"@vitest/coverage-v8": "^0.34.1",
"@vue/cli-plugin-babel": "^5.0.8", "@vue/cli-plugin-babel": "^5.0.8",
"@vue/cli-plugin-router": "~5.0.0", "@vue/cli-plugin-router": "~5.0.0",
"@vue/cli-plugin-unit-jest": "~5.0.0", "@vue/cli-plugin-unit-jest": "~5.0.0",
@ -44,12 +46,15 @@
"eslint-config-airbnb-base": "15.0.0", "eslint-config-airbnb-base": "15.0.0",
"eslint-import-resolver-alias": "1.1.2", "eslint-import-resolver-alias": "1.1.2",
"eslint-plugin-import": "2.26.0", "eslint-plugin-import": "2.26.0",
"eslint-plugin-jsdoc": "^46.4.3",
"eslint-plugin-vue": "^9.15.1", "eslint-plugin-vue": "^9.15.1",
"jest": "^27.0.5", "jest": "^27.0.5",
"jest-junit": "^13.0.0", "jest-junit": "^13.0.0",
"jsdoc": "^4.0.2", "jsdoc": "^4.0.2",
"jsdom": "^22.1.0",
"sass": "^1.32.7", "sass": "^1.32.7",
"sass-loader": "^12.0.0", "sass-loader": "^12.0.0",
"vite": "^4.4.6",
"vitest": "^0.33.0", "vitest": "^0.33.0",
"volar-service-vetur": "latest" "volar-service-vetur": "latest"
} }

View file

@ -1,3 +1,8 @@
/**
* @module applicationConfig
* @author T-Wrecks Team
* @copyright Safelite
*/
const applicationConfig = { const applicationConfig = {
CURRENT_ENVIRONMENT: process.env.VUE_APP_CURRENT_ENVIRONMENT, // "Localhost", "Dev", "QA", and "Prod" CURRENT_ENVIRONMENT: process.env.VUE_APP_CURRENT_ENVIRONMENT, // "Localhost", "Dev", "QA", and "Prod"
CONSUMER_CF_DISTRO: process.env.VUE_APP_CONSUMER_CF_DISTRO, CONSUMER_CF_DISTRO: process.env.VUE_APP_CONSUMER_CF_DISTRO,

View file

@ -1,5 +1,11 @@
import applicationConfig from '@/constants/application-config.js'; import applicationConfig from '@/constants/application-config.js';
/**
* @module cookieNames
* @requires applicationConfig
* @author T-Wrecks Team
* @copyright Safelite
*/
const cookieNames = { const cookieNames = {
ISS_SESSION_INFO: `ISSSessionInfo-${applicationConfig.CURRENT_ENVIRONMENT}`, ISS_SESSION_INFO: `ISSSessionInfo-${applicationConfig.CURRENT_ENVIRONMENT}`,

View file

@ -1,10 +1,10 @@
const dynamicStrings = { const dynamicStrings = Object.freeze({
GLOBAL_STATE: 'globalState', GLOBAL_STATE: 'globalState',
CUSTOM: 'custom', CUSTOM: 'custom',
ROUTER_LINK: 'routerLink:', ROUTER_LINK: 'routerLink:',
MODAL_LINK: 'modalLink', MODAL_LINK: 'modalLink',
TEXT_LINK: 'textLink', TEXT_LINK: 'textLink',
EXTERNAL_LINK: 'externalLink' EXTERNAL_LINK: 'externalLink'
}; });
export { dynamicStrings }; export default dynamicStrings;

View file

@ -2,7 +2,7 @@
// Example: {custom:glassName}, each key in the array is the value after custom:, like 'glassname' // 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. // Please use lowercase only so that we don't have to worry about case sensitivity.
const customMappings = { const customMappings = Object.freeze({
formattedglassname: [ formattedglassname: [
{ key: 'Windshield Single', transformedValue: 'windshield' }, { key: 'Windshield Single', transformedValue: 'windshield' },
{ key: 'Windshield Driver', transformedValue: 'driver side split windshield' }, { key: 'Windshield Driver', transformedValue: 'driver side split windshield' },
@ -20,12 +20,12 @@ const customMappings = {
{ key: 'Passenger Quarter', transformedValue: 'passenger side quarter panel' }, { key: 'Passenger Quarter', transformedValue: 'passenger side quarter panel' },
{ key: 'Passenger SlideDoor', transformedValue: 'passenger side sliding door' } { key: 'Passenger SlideDoor', transformedValue: 'passenger side sliding door' }
] ]
}; });
// Gets an instance of a string where the dynamic portion of the text {custom:KeyName} // Gets an instance of a string where the dynamic portion of the text {custom:KeyName}
// is replaced by a value from the above map. // is replaced by a value from the above map.
// If the value isn't found, return the original dynamic string without replacement // If the value isn't found, return the original dynamic string without replacement
export function getCustomTransformValue(dynamicString, key) { const getCustomTransformValue = (dynamicString, key) => {
// Get array key from the dynamic string // Get array key from the dynamic string
const regexExp = /{(.*?):(.*?)}/g; const regexExp = /{(.*?):(.*?)}/g;
const matches = [...dynamicString.matchAll(regexExp)]; const matches = [...dynamicString.matchAll(regexExp)];
@ -53,4 +53,6 @@ export function getCustomTransformValue(dynamicString, key) {
const finalString = dynamicString.replace(`{custom:${arrayKey}}`, mapObject.transformedValue); const finalString = dynamicString.replace(`{custom:${arrayKey}}`, mapObject.transformedValue);
return finalString; return finalString;
} };
export default getCustomTransformValue;

View file

@ -1,9 +1,9 @@
const endorsementOptions = { const endorsementOptions = Object.freeze({
EDUCATOR: 'Educator', EDUCATOR: 'Educator',
OEM_APPROVED: 'OEM Approved', OEM_APPROVED: 'OEM Approved',
FULL_GLASS: 'Full Glass Coverage', FULL_GLASS: 'Full Glass Coverage',
PARKING_GUARD: 'Parking Guard', PARKING_GUARD: 'Parking Guard',
REPAIR_WAIVED: 'Repair Waived' REPAIR_WAIVED: 'Repair Waived'
}; });
export { endorsementOptions }; export default endorsementOptions;

View file

@ -1,4 +1,9 @@
const errorMessages = { /**
* @module errorMessages
* @author T-Wrecks Team
* @copyright Safelite
*/
const errorMessages = Object.freeze({
DAMAGE_LOCATION_REQUIRED: 'Please select damage location', DAMAGE_LOCATION_REQUIRED: 'Please select damage location',
DAMAGE_SIDE_REQUIRED: 'Please select vehicle side', DAMAGE_SIDE_REQUIRED: 'Please select vehicle side',
DRIVER_SIDE_OPTIONS_REQUIRED: 'Please select window', DRIVER_SIDE_OPTIONS_REQUIRED: 'Please select window',
@ -46,6 +51,6 @@ const errorMessages = {
MAKE_REQUIRED: 'Please select your vehicle make', MAKE_REQUIRED: 'Please select your vehicle make',
MODEL_REQUIRED: 'Please select your vehicle model', MODEL_REQUIRED: 'Please select your vehicle model',
STYLE_REQUIRED: 'Please select your vehicle style' STYLE_REQUIRED: 'Please select your vehicle style'
}; });
export { errorMessages }; export default errorMessages;

View file

@ -1,17 +1,17 @@
const globalEvents = { const globalEvents = Object.freeze({
Categories: { Categories: {
GLOBAL_ALERT: 'GLOBAL_ALERT' GLOBAL_ALERT: 'GLOBAL_ALERT'
}, },
SubCategories: { SubCategories: {
PAGE_NOT_FOUND: 'PAGE_NOT_FOUND' PAGE_NOT_FOUND: 'PAGE_NOT_FOUND'
} }
}; });
const globalEventTypes = { const globalEventTypes = Object.freeze({
Success: 'alert-success', Success: 'alert-success',
Warning: 'alert-warning', Warning: 'alert-warning',
Info: 'alert-info', Info: 'alert-info',
Danger: 'alert-danger' Danger: 'alert-danger'
}; });
export { globalEvents, globalEventTypes }; export { globalEvents, globalEventTypes };

View file

@ -1,14 +1,14 @@
const experimentUniverses = { const experimentUniverses = Object.freeze({
ISS_FUNNEL: 'ISSFunnel' ISS_FUNNEL: 'ISSFunnel'
}; });
const experimentSettings = { const experimentSettings = Object.freeze({
GOOGLE_CUSTOM_DIMENSION_INDEX: 'Google Custom Dimension Index' GOOGLE_CUSTOM_DIMENSION_INDEX: 'Google Custom Dimension Index'
}; });
const experimentTriggers = { const experimentTriggers = Object.freeze({
SITE_ENTRY: 'SiteEntry', SITE_ENTRY: 'SiteEntry',
PAGE_ENTRY: 'PageEntry' PAGE_ENTRY: 'PageEntry'
}; });
export { experimentUniverses, experimentSettings, experimentTriggers }; export { experimentUniverses, experimentSettings, experimentTriggers };

View file

@ -1,13 +1,10 @@
/** /**
* @file global-rules.js * @module globalRules
* @summary Contains all the globally defined rules.
* @author MB * @author MB
* @copyright Safelite * @copyright Safelite
*/ */
const globalRules = Object.freeze({
/**
* @summary Contains all the globally defined rules.
*/
const globalRules = {
POLICYHOLDER_FIRST_NAME_REQUIRED: 'policyholder-first-name-required', POLICYHOLDER_FIRST_NAME_REQUIRED: 'policyholder-first-name-required',
POLICYHOLDER_LAST_NAME_REQUIRED: 'policyholder-last-name-required', POLICYHOLDER_LAST_NAME_REQUIRED: 'policyholder-last-name-required',
FIRST_NAME_REQUIRED: 'first-name-required', FIRST_NAME_REQUIRED: 'first-name-required',
@ -18,6 +15,6 @@ const globalRules = {
PHONE_NUMBER_FORMAT: 'phone-number-format', PHONE_NUMBER_FORMAT: 'phone-number-format',
PHONE_NUMBER_FORMAT_SHORT: 'phone-number-format-short', PHONE_NUMBER_FORMAT_SHORT: 'phone-number-format-short',
OPTION_REQUIRED: 'option-required' OPTION_REQUIRED: 'option-required'
}; });
export default globalRules; export default globalRules;

View file

@ -1,8 +1,8 @@
const partTypeStrings = { const partTypeStrings = Object.freeze({
FRONT_WIPER: 'FRONT WIPER', FRONT_WIPER: 'FRONT WIPER',
REAR_WIPER: 'REAR WIPER', REAR_WIPER: 'REAR WIPER',
RAIN_DEFENSE: 'RAIN DEFENSE', RAIN_DEFENSE: 'RAIN DEFENSE',
RECALIBRATION: 'RECALIBRATION' RECALIBRATION: 'RECALIBRATION'
}; });
export { partTypeStrings }; export default partTypeStrings;

View file

@ -1,5 +1,5 @@
const queryStrings = { const queryStrings = Object.freeze({
ISS_PAGE: 'issPage' ISS_PAGE: 'issPage'
}; });
export { queryStrings }; export default queryStrings;

View file

@ -1,4 +1,9 @@
export const states = { /**
* @module states
* @author T-Wrecks Team
* @copyright Safelite
*/
const states = Object.freeze({
AL: 'Alabama', AL: 'Alabama',
AK: 'Alaska', AK: 'Alaska',
AZ: 'Arizona', AZ: 'Arizona',
@ -50,4 +55,6 @@ export const states = {
WV: 'West Virginia', WV: 'West Virginia',
WI: 'Wisconsin', WI: 'Wisconsin',
WY: 'Wyoming' WY: 'Wyoming'
}; });
export default states;

View file

@ -1,7 +1,7 @@
// TintMap with array keys by location, lowercase to avoid as much string mismatching as possible. // 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. // 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. // See vehicle-parts for implementation example.
const tintMap = { const tintMap = Object.freeze({
other: [ other: [
// Blue Shade // Blue Shade
{ name: 'blue tint, blue shade', src: 'Glass-BlueShade-BlueTint.svg' }, { name: 'blue tint, blue shade', src: 'Glass-BlueShade-BlueTint.svg' },
@ -71,23 +71,19 @@ const tintMap = {
// No shade or tint // No shade or tint
{ name: 'clear', src: 'Windshield-NoShade-NoTint.svg' } { name: 'clear', src: 'Windshield-NoShade-NoTint.svg' }
] ]
}; });
// Gets the tint image source string given the glass location, and the tint description (like 'Green Tint') // 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. // 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. // Returns undefined if no items are found.
export function getTintImage(glassLocation, colorString) { const getTintImage = (glassLocation, colorString) => {
// Windshield glass has special images, all other glass uses the same though. // Windshield glass has special images, all other glass uses the same though.
if (glassLocation.toLowerCase() !== 'windshield') { const glassLoc = (glassLocation.toLowerCase() !== 'windshield') ? 'other' : 'windshield';
glassLocation = 'other'; if (tintMap[glassLoc] === undefined) {
}
if (tintMap[glassLocation.toLowerCase()] === undefined) {
return ''; return '';
} }
const tintImageSource = tintMap[glassLocation.toLowerCase()] return tintMap[glassLoc].find((item) => item.name.toLowerCase() === colorString.toLowerCase());
.find((item) => item.name.toLowerCase() === colorString.toLowerCase()); };
return tintImageSource; export default getTintImage;
}

View file

@ -1,4 +1,4 @@
const vehicleCategories = { const vehicleCategories = Object.freeze({
CAR: 'CAR', CAR: 'CAR',
TRUCK: 'TRUCK', TRUCK: 'TRUCK',
VAN: 'VAN', VAN: 'VAN',
@ -6,6 +6,6 @@ const vehicleCategories = {
SUV: 'SUV', SUV: 'SUV',
MOTORHOME: 'MOTOR HOME', MOTORHOME: 'MOTOR HOME',
SEMI: 'SEMI' SEMI: 'SEMI'
}; });
export { vehicleCategories }; export default vehicleCategories;

View file

@ -2,4 +2,4 @@ const vehicleSelectionOptions = Object.freeze({
VEHICLE_NOT_LISTED: 'Vehicle not listed' VEHICLE_NOT_LISTED: 'Vehicle not listed'
}); });
export { vehicleSelectionOptions }; export default vehicleSelectionOptions;

View file

@ -4,4 +4,4 @@ const vinLookupMethodSelections = Object.freeze({
HOMEADDRESS: 'HomeAddress' HOMEADDRESS: 'HomeAddress'
}); });
export { vinLookupMethodSelections }; export default vinLookupMethodSelections;

View file

@ -30,7 +30,7 @@ import {
handleButtonComponentFocus, handleButtonComponentFocus,
handleInputComponentBlur handleInputComponentBlur
} from '@/helpers/button-question-focus-helper'; } 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 { export default {
name: 'base-input-button', name: 'base-input-button',

View file

@ -1,4 +1,4 @@
export const inputButtonProps = { const inputButtonProps = {
value: { value: {
type: [String, Number], type: [String, Number],
required: true required: true
@ -36,3 +36,5 @@ export const inputButtonProps = {
}, },
suppressError: Boolean suppressError: Boolean
}; };
export default inputButtonProps;

View file

@ -1,7 +1,18 @@
/* eslint-disable max-len */
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import buttonQuestion from '@/digital-components/button-question/button-question'; import buttonQuestion from '@/digital-components/button-question/button-question.vue';
import { getMountOptions } from '@/helpers/unit-test-helper.js'; import { getMountOptions } from '@/helpers/unit-test-helper.js';
/** @ignore */
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', () => { describe('buttonQuestion.vue', () => {
it('Fieldset classes should contain row if button type is listCard', () => { it('Fieldset classes should contain row if button type is listCard', () => {
// Act // Act
@ -1009,12 +1020,3 @@ 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;
}

View file

@ -76,12 +76,12 @@
</template> </template>
<script> <script>
import listButton from '@/ux-components/list-button/list-button'; import listButton from '@/ux-components/list-button/list-button.vue';
import listButtonHorizontal from '@/ux-components/list-button-horizontal/list-button-horizontal'; import listButtonHorizontal from '@/ux-components/list-button-horizontal/list-button-horizontal.vue';
import listCard from '@/ux-components/list-card/list-card'; import listCard from '@/ux-components/list-card/list-card.vue';
import radio from '@/ux-components/radio/radio'; import radio from '@/ux-components/radio/radio.vue';
import { ErrorMessage } from 'vee-validate'; import { ErrorMessage } from 'vee-validate';
import providerPrefRadio from '@/layouts/provider-preference/provider-pref-radio/provider-pref-radio'; import providerPrefRadio from '@/layouts/provider-preference/provider-pref-radio/provider-pref-radio.vue';
export default { export default {
name: 'button-question', name: 'button-question',

View file

@ -1,5 +1,5 @@
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import dropdownQuestion from './dropdown-question'; import dropdownQuestion from '@/digital-components/dropdown-question/dropdown-question.vue';
// Mock CMS content // Mock CMS content
const questionText = 'Question Text'; const questionText = 'Question Text';

View file

@ -111,12 +111,12 @@ export default {
const words = this.questionText.toString().split(/[ ]+/); const words = this.questionText.toString().split(/[ ]+/);
words.forEach((word) => { words.forEach((word) => {
const position = 1; const position = 1;
word = [ const newWord = [
word.toString().slice(0, position), word.toString().slice(0, position),
noBreakChar, noBreakChar,
word.toString().slice(position) word.toString().slice(position)
].join(''); ].join('');
questionText += `${word} `; questionText += `${newWord} `;
}); });
questionText = questionText.trimEnd(); questionText = questionText.trimEnd();

View file

@ -2,7 +2,7 @@ import { shallowMount } from '@vue/test-utils';
import crypto from 'crypto'; import crypto from 'crypto';
import { useForm } from 'vee-validate'; import { useForm } from 'vee-validate';
import { Modal } from 'bootstrap'; import { Modal } from 'bootstrap';
import modal from './modal'; import modal from '@/digital-components/modal/modal.vue';
jest.mock('vee-validate', () => ({ jest.mock('vee-validate', () => ({
useForm: jest.fn() useForm: jest.fn()

View file

@ -34,7 +34,7 @@
loaderColor="white" loaderColor="white"
:buttonText="footerButtonText" :buttonText="footerButtonText"
:class="(isButtonDisabled || isFooterButtonDisabled) && 'form-test-invalid'" :class="(isButtonDisabled || isFooterButtonDisabled) && 'form-test-invalid'"
@click-event="validateAndEmit" /> @clickEvent="validateAndEmit" />
</div> </div>
</div> </div>
</div> </div>
@ -42,7 +42,7 @@
</template> </template>
<script> <script>
import modalButtonMain from '@/ux-components/modal-button-main/modal-button-main'; import modalButtonMain from '@/ux-components/modal-button-main/modal-button-main.vue';
import { Modal } from 'bootstrap'; import { Modal } from 'bootstrap';
import { useForm } from 'vee-validate'; import { useForm } from 'vee-validate';
@ -69,6 +69,7 @@ export default {
const { meta, validate, resetForm } = useForm(); const { meta, validate, resetForm } = useForm();
// TODO: Correct Duplicate key 'modalId' issue.
return { return {
modalId, modalId,
meta, meta,

View file

@ -1,8 +1,42 @@
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import questionChain from '@/digital-components/question-chain/question-chain'; import questionChain from '@/digital-components/question-chain/question-chain.vue';
import { getMountOptions } from '@/helpers/unit-test-helper.js'; import { getMountOptions } from '@/helpers/unit-test-helper.js';
import { nextTick } from 'vue'; import { nextTick } from 'vue';
/** @ignore */
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('Question Chain component', () => {
describe('on create...', () => { describe('on create...', () => {
test('Should populate questions data array', async () => { test('Should populate questions data array', async () => {
@ -205,7 +239,7 @@ describe('Question Chain component', () => {
wrapper.vm.getQuestionChainAnswerIfComplete(testReturnedAnswer); wrapper.vm.getQuestionChainAnswerIfComplete(testReturnedAnswer);
// Assert // 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 () => { test('should return false if returnedAnswer is a nextQuestion (not a final answer)', async () => {
@ -279,36 +313,3 @@ 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 };
}

View file

@ -23,7 +23,7 @@
</template> </template>
<script> <script>
import buttonQuestion from '@/digital-components/button-question/button-question'; import buttonQuestion from '@/digital-components/button-question/button-question.vue';
import { useValidateForm } from 'vee-validate'; import { useValidateForm } from 'vee-validate';
export default { export default {

View file

@ -1,5 +1,5 @@
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import TextBlock from './text-block'; import TextBlock from '@/digital-components/text-block/text-block.vue';
const mockCmsContent = { const mockCmsContent = {
Text: 'Sample text here.' Text: 'Sample text here.'

View file

@ -1,5 +1,5 @@
// Components // Components
import textareaQuestion from '@/digital-components/textarea-question/textarea-question'; import textareaQuestion from '@/digital-components/textarea-question/textarea-question.vue';
// Supporting Files // Supporting Files
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';

View file

@ -105,14 +105,16 @@ export default {
}, },
computed: { computed: {
/** /**
* @summary Returns the number of characters in the textarea field. * @summary Returns the number of characters in the textarea field.
*/ * @returns {number}
*/
characterCount() { characterCount() {
return this?.modelValue?.length ?? 0; return this?.modelValue?.length ?? 0;
}, },
/** /**
* @summary Returns the CMS text associated with the question. * @summary Returns the CMS text associated with the question.
*/ * @returns {string} QuestionText from cms data.
*/
questionText() { questionText() {
return this.getCmsContent(this.cmsWidgetName, 'QuestionText'); return this.getCmsContent(this.cmsWidgetName, 'QuestionText');
}, },
@ -127,8 +129,9 @@ export default {
}, },
methods: { methods: {
/** /**
* @summary Removes whitespace from the end of pasted content. * @summary Removes whitespace from the end of pasted content.
*/ * @param {event} evt - Browser event
*/
trimOnPaste(evt) { trimOnPaste(evt) {
evt.stopPropagation(); evt.stopPropagation();
evt.preventDefault(); evt.preventDefault();

View file

@ -1,5 +1,5 @@
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import textboxQuestion from './textbox-question'; import textboxQuestion from '@/digital-components/textbox-question/textbox-question.vue';
// Mock CMS content // Mock CMS content
const questionText = 'Question Text'; const questionText = 'Question Text';

View file

@ -1,5 +1,7 @@
<template> <template>
<div class="textbox-question" :class="(errors && errors.length) || hasError ? 'has-error' : ''"> <div
class="textbox-question"
:class="(errors && errors.length) || hasError ? 'has-error' : ''">
<label <label
v-if="displayQuestionText" v-if="displayQuestionText"
:for="inputId" :for="inputId"
@ -43,7 +45,10 @@
@focus="$emit('focus', $event.target.value)" @focus="$emit('focus', $event.target.value)"
@paste="trimOnPaste" @paste="trimOnPaste"
@drop="trimOnPaste" /> @drop="trimOnPaste" />
<button v-if="includeSearchIcon" type="submit" aria-label="Search button" /> <button
v-if="includeSearchIcon"
type="submit"
aria-label="Search button" />
<button <button
v-if="includeSelectIcon" v-if="includeSelectIcon"
type="submit" type="submit"
@ -51,8 +56,12 @@
:data-bs-target="'#' + cmsWidgetName" :data-bs-target="'#' + cmsWidgetName"
aria-label="Select button" /> aria-label="Select button" />
</div> </div>
<div v-show="errorMessage" class="row my-1 form-test-error"> <div
<span class="d-inline-flex mt-0" role="alert">{{ errorMessage }}</span> v-show="errorMessage"
class="row my-1 form-test-error">
<span
class="d-inline-flex mt-0"
role="alert">{{ errorMessage }}</span>
</div> </div>
</div> </div>
</template> </template>
@ -107,12 +116,12 @@ export default {
let initialValue; let initialValue;
switch (typeof modelValue) { switch (typeof modelValue) {
case 'number': case 'number':
initialValue = modelValue; initialValue = modelValue;
break; break;
default: default:
initialValue = modelValue && modelValue.length > 0 ? modelValue : ''; initialValue = modelValue && modelValue.length > 0 ? modelValue : '';
break; break;
} }
const fieldOptions = { const fieldOptions = {
@ -122,11 +131,9 @@ export default {
}; };
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
const { errorMessage, handleBlur, handleChange, meta, validate, errors } = useField( const { errorMessage, handleBlur, handleChange, meta, validate, errors } = useField(props.inputId,
props.inputId,
props.validationRules, props.validationRules,
fieldOptions fieldOptions);
);
return { return {
errorMessage, errorMessage,

View file

@ -1,4 +1,4 @@
import { dynamicStrings } from '@/constants/dynamic-strings'; import dynamicStrings from '@/constants/dynamic-strings';
import { useMainStore } from '@/store'; import { useMainStore } from '@/store';
export function fetchCmsContentForPage(issPage) { export function fetchCmsContentForPage(issPage) {

View file

@ -1,5 +1,5 @@
import { defineRule } from 'vee-validate'; import { defineRule } from 'vee-validate';
import { errorMessages } from '@/constants/error-messages'; import errorMessages from '@/constants/error-messages';
import globalRules from '@/constants/global-rules'; import globalRules from '@/constants/global-rules';
import { required, regex } from '@/helpers/validation-rules'; import { required, regex } from '@/helpers/validation-rules';

View file

@ -1,6 +1,6 @@
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios.js'; import { navigationScenarios } from '@/router/router-constants/navigation-scenarios.js';
import { RouterLinkStub } from '@vue/test-utils'; import { RouterLinkStub } from '@vue/test-utils';
import { vehicleCategories } from '@/constants/vehicle-categories.js'; import vehicleCategories from '@/constants/vehicle-categories.js';
import { issPageValues } from '@/router/router-constants/issPage-values'; import { issPageValues } from '@/router/router-constants/issPage-values';
import cookieNames from '@/constants/cookie-names'; import cookieNames from '@/constants/cookie-names';
import { Form } from 'vee-validate'; import { Form } from 'vee-validate';
@ -10,7 +10,7 @@ import {
setCookieProperties setCookieProperties
} from '@/helpers/cookie-helper'; } from '@/helpers/cookie-helper';
import { GaActions } from '@/constants/analytics'; import { GaActions } from '@/constants/analytics';
import { queryStrings } from '@/constants/query-strings'; import queryStrings from '@/constants/query-strings';
import { useMainStore } from '@/store'; import { useMainStore } from '@/store';
import { mapStores } from 'pinia'; import { mapStores } from 'pinia';
import { createTestingPinia } from '@pinia/testing'; import { createTestingPinia } from '@pinia/testing';

View file

@ -95,8 +95,8 @@ 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 { defineRule } from 'vee-validate';
import { required, regex } from '@/helpers/validation-rules'; import { required, regex } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages'; import errorMessages from '@/constants/error-messages';
import { states } from '@/constants/states'; import states from '@/constants/states';
import { endpoints } from '@/constants/endpoints'; import { endpoints } from '@/constants/endpoints';
// DEFINE VALIDATION RULES // DEFINE VALIDATION RULES

View file

@ -1,5 +1,5 @@
import { shallowMount } from '@vue/test-utils'; 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 { useMainStore } from '@/store';
import { createApp } from 'vue'; import { createApp } from 'vue';
import { createPinia, mapStores } from 'pinia'; import { createPinia, mapStores } from 'pinia';

View file

@ -68,7 +68,7 @@
import { settleAllPromises } from '@/helpers/layout-helper'; import { settleAllPromises } from '@/helpers/layout-helper';
import { useMainStore } from '@/store'; import { useMainStore } from '@/store';
import { issPageValues } from '@/router/router-constants/issPage-values'; import { issPageValues } from '@/router/router-constants/issPage-values';
import { errorMessages } from '@/constants/error-messages'; import errorMessages from '@/constants/error-messages';
import { required } from '@/helpers/validation-rules'; import { required } from '@/helpers/validation-rules';
import { Form, defineRule } from 'vee-validate'; import { Form, defineRule } from 'vee-validate';
import { isGlassAvailableForCarId } from '@/helpers/damage-helper'; import { isGlassAvailableForCarId } from '@/helpers/damage-helper';

View file

@ -80,12 +80,12 @@
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper'; import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
import { settleAllPromises } from '@/helpers/layout-helper'; import { settleAllPromises } from '@/helpers/layout-helper';
import { useMainStore } from '@/store'; import { useMainStore } from '@/store';
import { errorMessages } from '@/constants/error-messages'; import errorMessages from '@/constants/error-messages';
import { required } from '@/helpers/validation-rules'; import { required } from '@/helpers/validation-rules';
import { defineRule, Form } from 'vee-validate'; import { defineRule, Form } from 'vee-validate';
import { getDamageString, isGlassAvailableForCarId } from '@/helpers/damage-helper.js'; import { getDamageString, isGlassAvailableForCarId } from '@/helpers/damage-helper.js';
import { routerParams } from '@/router/router-params.js'; import { routerParams } from '@/router/router-params.js';
import { states } from '@/constants/states'; import states from '@/constants/states';
// Import Component // Import Component
import baseFormMixin from '@/mixins/base-form-mixin'; import baseFormMixin from '@/mixins/base-form-mixin';

View file

@ -7,10 +7,10 @@ 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 baseMixin from '@/mixins/base-mixin';
import { getRandomString, getRandomInt } from '@/helpers/data-generation'; 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 { createTestingPinia } from '@pinia/testing';
import { issPageValues } from '@/router/router-constants/issPage-values'; import { issPageValues } from '@/router/router-constants/issPage-values';
import { vehicleSelectionOptions } from '@/constants/vehicle-selection-options'; import vehicleSelectionOptions from '@/constants/vehicle-selection-options';
// Mock fetchCmsContentForPage // Mock fetchCmsContentForPage
jest.mock('@/helpers/cms-content-helper', () => ({ jest.mock('@/helpers/cms-content-helper', () => ({

View file

@ -50,8 +50,8 @@ import { fetchCmsContentForPage } from '@/helpers/cms-content-helper.js';
import { Form } from 'vee-validate'; import { Form } from 'vee-validate';
import BaseFormMixin from '@/mixins/base-form-mixin.js'; import BaseFormMixin from '@/mixins/base-form-mixin.js';
import { issPageValues } from '@/router/router-constants/issPage-values.js'; import { issPageValues } from '@/router/router-constants/issPage-values.js';
import { vehicleSelectionOptions } from '@/constants/vehicle-selection-options.js'; import vehicleSelectionOptions from '@/constants/vehicle-selection-options.js';
import { endorsementOptions } from '@/constants/endorsement-options.js'; import endorsementOptions from '@/constants/endorsement-options.js';
import globalRules from '@/constants/global-rules.js'; import globalRules from '@/constants/global-rules.js';
import { useMainStore } from '@/store/index.js'; import { useMainStore } from '@/store/index.js';

View file

@ -53,7 +53,7 @@
// Import Supporting Files // Import Supporting Files
import { fetchCmsContentForPage, setupModalLinks } from '@/helpers/cms-content-helper'; import { fetchCmsContentForPage, setupModalLinks } from '@/helpers/cms-content-helper';
import { settleAllPromises } from '@/helpers/layout-helper'; import { settleAllPromises } from '@/helpers/layout-helper';
import { errorMessages } from '@/constants/error-messages'; import errorMessages from '@/constants/error-messages';
import buttonQuestion from '@/digital-components/button-question/button-question'; import buttonQuestion from '@/digital-components/button-question/button-question';
import { issPageValues } from '@/router/router-constants/issPage-values'; import { issPageValues } from '@/router/router-constants/issPage-values';

View file

@ -23,7 +23,7 @@
<script> <script>
import modal from '@/digital-components/modal/modal'; import modal from '@/digital-components/modal/modal';
import { states } from '@/constants/states'; import states from '@/constants/states';
export default { export default {
name: 'content-group-modal', name: 'content-group-modal',

View file

@ -21,7 +21,7 @@
<script> <script>
import modal from '@/digital-components/modal/modal'; import modal from '@/digital-components/modal/modal';
import { processIfStatements } from '@/helpers/cms-content-helper'; import { processIfStatements } from '@/helpers/cms-content-helper';
import { states } from '@/constants/states'; import states from '@/constants/states';
export default { export default {
name: 'content-group-modal', name: 'content-group-modal',

View file

@ -2,7 +2,7 @@
import { render } from '@testing-library/vue'; import { render } from '@testing-library/vue';
import userEvent from '@testing-library/user-event'; import userEvent from '@testing-library/user-event';
import { issPageValues } from '@/router/router-constants/issPage-values'; import { issPageValues } from '@/router/router-constants/issPage-values';
import { queryStrings } from '@/constants/query-strings'; import queryStrings from '@/constants/query-strings';
import { GaActions } from '@/constants/analytics'; import { GaActions } from '@/constants/analytics';
import tpaRecalToggle from './tpa-recal-toggle'; import tpaRecalToggle from './tpa-recal-toggle';

View file

@ -60,7 +60,7 @@
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper'; import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
import { settleAllPromises } from '@/helpers/layout-helper'; import { settleAllPromises } from '@/helpers/layout-helper';
import { required } from '@/helpers/validation-rules'; import { required } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages'; import errorMessages from '@/constants/error-messages';
import buttonQuestion from '@/digital-components/button-question/button-question'; import buttonQuestion from '@/digital-components/button-question/button-question';
import { useMainStore } from '@/store'; import { useMainStore } from '@/store';
import { getServiceabilityDetails, getZipCodeData } from '@/helpers/service-location-helper'; import { getServiceabilityDetails, getZipCodeData } from '@/helpers/service-location-helper';

View file

@ -18,7 +18,7 @@ import textboxQuestion from '@/digital-components/textbox-question/textbox-quest
// Supporting Files // Supporting Files
import { defineRule } from 'vee-validate'; import { defineRule } from 'vee-validate';
import { required, regex } from '@/helpers/validation-rules'; import { required, regex } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages'; import errorMessages from '@/constants/error-messages';
// Define Validation Rules // Define Validation Rules
defineRule('zip-required', required(errorMessages.SERVICE_ZIP_REQUIRED)); defineRule('zip-required', required(errorMessages.SERVICE_ZIP_REQUIRED));

View file

@ -15,9 +15,10 @@ import buttonQuestion from '@/digital-components/button-question/button-question
import { processIfStatements } from '@/helpers/cms-content-helper'; import { processIfStatements } from '@/helpers/cms-content-helper';
import damageLocationsSelected from '@/constants/damage-locations-selected'; import damageLocationsSelected from '@/constants/damage-locations-selected';
import servicePackageRadio from '@/layouts/service-packages/service-package-question/service-package-radio/service-package-radio'; import servicePackageRadio from '@/layouts/service-packages/service-package-question/service-package-radio/service-package-radio';
import { partTypeStrings } from '@/constants/part-type-strings'; import partTypeStrings from '@/constants/part-type-strings';
import { useMainStore } from '@/store'; import { useMainStore } from '@/store';
import { allGlassPartsAndItemsHavePrices } from '@/layouts/service-packages/service-package-helper/service-package-helper'; import { allGlassPartsAndItemsHavePrices } from '@/layouts/service-packages/service-package-helper/service-package-helper';
const glassLocations = damageLocationsSelected; const glassLocations = damageLocationsSelected;
const packageNames = { const packageNames = {

View file

@ -16,7 +16,7 @@
import buttonQuestion from '@/digital-components/button-question/button-question'; import buttonQuestion from '@/digital-components/button-question/button-question';
import { defineRule } from 'vee-validate'; import { defineRule } from 'vee-validate';
import { required } from '@/helpers/validation-rules'; import { required } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages'; import errorMessages from '@/constants/error-messages';
// DEFINE VALIDATION RULES // DEFINE VALIDATION RULES
defineRule('damage-location-required', required(errorMessages.DAMAGE_LOCATION_REQUIRED)); defineRule('damage-location-required', required(errorMessages.DAMAGE_LOCATION_REQUIRED));

View file

@ -46,7 +46,7 @@ import buttonQuestion from '@/digital-components/button-question/button-question
import replaceOptionsQuestion from '@/layouts/vehicle-damage/replace-options-question/replace-options-question'; import replaceOptionsQuestion from '@/layouts/vehicle-damage/replace-options-question/replace-options-question';
import { defineRule } from 'vee-validate'; import { defineRule } from 'vee-validate';
import { required } from '@/helpers/validation-rules'; import { required } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages'; import errorMessages from '@/constants/error-messages';
import damageLocationsSelected from '@/constants/damage-locations-selected'; import damageLocationsSelected from '@/constants/damage-locations-selected';
// DEFINE VALIDATION RULES // DEFINE VALIDATION RULES

View file

@ -3,7 +3,7 @@ import { mount, flushPromises } from '@vue/test-utils';
import { createTestingPinia } from '@pinia/testing'; import { createTestingPinia } from '@pinia/testing';
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios'; import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
import { routerParams } from '@/router/router-params'; import { routerParams } from '@/router/router-params';
import { vehicleCategories } from '@/constants/vehicle-categories'; import vehicleCategories from '@/constants/vehicle-categories';
import VehicleDamageComponent from '@/layouts/vehicle-damage/vehicle-damage'; import VehicleDamageComponent from '@/layouts/vehicle-damage/vehicle-damage';
const mockRoute = { const mockRoute = {

View file

@ -88,7 +88,7 @@ import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
import { settleAllPromises } from '@/helpers/layout-helper'; import { settleAllPromises } from '@/helpers/layout-helper';
import { Form, defineRule } from 'vee-validate'; import { Form, defineRule } from 'vee-validate';
import { required } from '@/helpers/validation-rules'; import { required } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages'; import errorMessages from '@/constants/error-messages';
import damageLocationsCms from '@/constants/damage-locations-cms.js'; import damageLocationsCms from '@/constants/damage-locations-cms.js';
import damageLocationsSelected from '@/constants/damage-locations-selected.js'; import damageLocationsSelected from '@/constants/damage-locations-selected.js';
import { useMainStore } from '@/store'; import { useMainStore } from '@/store';

View file

@ -48,7 +48,7 @@ import alert from '@/ux-components/alert/alert';
import { defineRule } from 'vee-validate'; import { defineRule } from 'vee-validate';
import { required } from '@/helpers/validation-rules'; import { required } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages'; import errorMessages from '@/constants/error-messages';
import damageLocationsSelected from '@/constants/damage-locations-selected.js'; import damageLocationsSelected from '@/constants/damage-locations-selected.js';
// DEFINE VALIDATION RULES // DEFINE VALIDATION RULES

View file

@ -1,14 +1,14 @@
/* eslint-env jest */ /* eslint-env jest */
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios'; import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
import { queryStrings } from '@/constants/query-strings'; import queryStrings from '@/constants/query-strings';
import { GaActions } from '@/constants/analytics'; import { GaActions } from '@/constants/analytics';
import { vinLookupMethodSelections } from '@/constants/vin-lookup-methods'; import vinLookupMethodSelections from '@/constants/vin-lookup-methods';
import { useMainStore } from '@/store'; import { useMainStore } from '@/store';
import { createTestingPinia } from '@pinia/testing'; import { createTestingPinia } from '@pinia/testing';
import { mapStores } from 'pinia'; import { mapStores } from 'pinia';
import { defineRule } from 'vee-validate'; import { defineRule } from 'vee-validate';
import { errorMessages } from '@/constants/error-messages'; import errorMessages from '@/constants/error-messages';
import globalRules from '@/constants/global-rules'; import globalRules from '@/constants/global-rules';
import { required } from '@/helpers/validation-rules'; import { required } from '@/helpers/validation-rules';
import VehicleLookup from '@/layouts/vehicle-lookup/vehicle-lookup'; import VehicleLookup from '@/layouts/vehicle-lookup/vehicle-lookup';

View file

@ -43,7 +43,7 @@ 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 { Form } from 'vee-validate';
import BaseFormMixin from '@/mixins/base-form-mixin'; import BaseFormMixin from '@/mixins/base-form-mixin';
import { vinLookupMethodSelections } from '@/constants/vin-lookup-methods'; import vinLookupMethodSelections from '@/constants/vin-lookup-methods';
import { useMainStore } from '@/store'; import { useMainStore } from '@/store';
// Import Component // Import Component

View file

@ -13,7 +13,7 @@
// Import Other Supporting Files // Import Other Supporting Files
import { useMainStore } from '@/store'; import { useMainStore } from '@/store';
import { vinLookupMethodSelections } from '@/constants/vin-lookup-methods'; import vinLookupMethodSelections from '@/constants/vin-lookup-methods';
import { settleAllPromises } from '@/helpers/layout-helper'; import { settleAllPromises } from '@/helpers/layout-helper';
import globalRules from '@/constants/global-rules'; import globalRules from '@/constants/global-rules';

View file

@ -46,11 +46,11 @@
import buttonQuestion from '@/digital-components/button-question/button-question'; import buttonQuestion from '@/digital-components/button-question/button-question';
// Supporting files // Supporting files
import { getTintImage } from '@/constants/tint-mapper'; import getTintImage from '@/constants/tint-mapper';
import { getCustomTransformValue } from '@/constants/dynamictext-mapper'; import getCustomTransformValue from '@/constants/dynamictext-mapper';
import { defineRule } from 'vee-validate'; import { defineRule } from 'vee-validate';
import { required } from '@/helpers/validation-rules'; import { required } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages'; import errorMessages from '@/constants/error-messages';
export default { export default {
name: 'glass-part-question', name: 'glass-part-question',

View file

@ -89,7 +89,7 @@ import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
import { settleAllPromises } from '@/helpers/layout-helper'; import { settleAllPromises } from '@/helpers/layout-helper';
import { Form, defineRule } from 'vee-validate'; import { Form, defineRule } from 'vee-validate';
import { required } from '@/helpers/validation-rules'; import { required } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages'; import errorMessages from '@/constants/error-messages';
// define validation rules // define validation rules
defineRule('year-required', required(errorMessages.YEAR_REQUIRED)); defineRule('year-required', required(errorMessages.YEAR_REQUIRED));

View file

@ -3,7 +3,7 @@ import { render } from '@testing-library/vue';
import userEvent from '@testing-library/user-event'; import userEvent from '@testing-library/user-event';
import '@testing-library/jest-dom'; import '@testing-library/jest-dom';
import { issPageValues } from '@/router/router-constants/issPage-values'; import { issPageValues } from '@/router/router-constants/issPage-values';
import { queryStrings } from '@/constants/query-strings'; import queryStrings from '@/constants/query-strings';
import { GaActions } from '@/constants/analytics'; import { GaActions } from '@/constants/analytics';
import VinLocationInformationComponent from '@/layouts/vin-lookup/vin-location-information/vin-location-information'; import VinLocationInformationComponent from '@/layouts/vin-lookup/vin-location-information/vin-location-information';

View file

@ -4,9 +4,9 @@ import { flushPromises } from '@vue/test-utils';
import { render, waitFor } from '@testing-library/vue'; import { render, waitFor } from '@testing-library/vue';
import { createTestingPinia } from '@pinia/testing'; import { createTestingPinia } from '@pinia/testing';
import userEvent from '@testing-library/user-event'; import userEvent from '@testing-library/user-event';
import { errorMessages } from '@/constants/error-messages'; import errorMessages from '@/constants/error-messages';
import { issPageValues } from '@/router/router-constants/issPage-values'; import { issPageValues } from '@/router/router-constants/issPage-values';
import { queryStrings } from '@/constants/query-strings'; import queryStrings from '@/constants/query-strings';
import { GaActions } from '@/constants/analytics'; import { GaActions } from '@/constants/analytics';
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios'; import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
import { routerParams } from '@/router/router-params'; import { routerParams } from '@/router/router-params';

View file

@ -13,7 +13,7 @@
// Import Other Supporting File(s) // Import Other Supporting File(s)
import { defineRule } from 'vee-validate'; import { defineRule } from 'vee-validate';
import { regex, required } from '@/helpers/validation-rules'; import { regex, required } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages'; import errorMessages from '@/constants/error-messages';
// Import Component(s) // Import Component(s)
import textboxQuestion from '@/digital-components/textbox-question/textbox-question'; import textboxQuestion from '@/digital-components/textbox-question/textbox-question';

View file

@ -169,10 +169,10 @@ import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
import { settleAllPromises } from '@/helpers/layout-helper'; import { settleAllPromises } from '@/helpers/layout-helper';
import { Form, defineRule } from 'vee-validate'; import { Form, defineRule } from 'vee-validate';
import { required, regex } from '@/helpers/validation-rules'; import { required, regex } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages'; import errorMessages from '@/constants/error-messages';
import BaseFormMixin from '@/mixins/base-form-mixin.js'; import BaseFormMixin from '@/mixins/base-form-mixin.js';
import { useMainStore } from '@/store'; import { useMainStore } from '@/store';
import { states } from '@/constants/states'; import states from '@/constants/states';
import globalRules from '@/constants/global-rules'; import globalRules from '@/constants/global-rules';
// define validation rules // define validation rules

View file

@ -4,7 +4,7 @@ import {
getSessionIdValue, getSessionIdValue,
getSessionKeyValue getSessionKeyValue
} from '@/helpers/cookie-helper'; } from '@/helpers/cookie-helper';
import { queryStrings } from '@/constants/query-strings'; import queryStrings from '@/constants/query-strings';
import { experimentSettings } from '@/constants/experiments'; import { experimentSettings } from '@/constants/experiments';
import { import {
analyticsPageEvents, analyticsPageEvents,

View file

@ -1,9 +1,9 @@
import { mapStores } from 'pinia'; import { mapStores } from 'pinia';
import { useMainStore } from '@/store'; import { useMainStore } from '@/store';
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios'; import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
import { vehicleCategories } from '@/constants/vehicle-categories.js'; import vehicleCategories from '@/constants/vehicle-categories.js';
import { queryStrings } from '@/constants/query-strings'; import queryStrings from '@/constants/query-strings';
import { dynamicStrings } from '@/constants/dynamic-strings'; import dynamicStrings from '@/constants/dynamic-strings';
import { routerParams } from '@/router/router-constants/router-params'; import { routerParams } from '@/router/router-constants/router-params';
export default { export default {

View file

@ -1,4 +1,4 @@
import { inputButtonProps } from '@/digital-components/base-input-button/button-functionality-props'; import inputButtonProps from '@/digital-components/base-input-button/button-functionality-props';
export default { export default {
model: { model: {

View file

@ -761,6 +761,9 @@ export const useMainStore = defineStore({
// These could be undefined // These could be undefined
this.order.policy.noCoverage = vehicle.noCoverage; this.order.policy.noCoverage = vehicle.noCoverage;
this.order.payment.insuranceCoverage.coverageStatus = vehicle.noCoverage
? coverageStatuses.NO_COMP
: coverageStatuses.PENDING;
this.order.policy.deductible.replace = vehicle.deductible; this.order.policy.deductible.replace = vehicle.deductible;
this.order.policy.deductible.repair = vehicle?.repairWaived ?? false ? 0 : vehicle.deductible; this.order.policy.deductible.repair = vehicle?.repairWaived ?? false ? 0 : vehicle.deductible;

View file

@ -197,6 +197,24 @@ describe('Store', () => {
expect(store.order.policy).toMatchObject(expectedPolicy); expect(store.order.policy).toMatchObject(expectedPolicy);
}); });
it.each([
[true, coverageStatuses.NO_COMP],
[false, coverageStatuses.PENDING]
])('UpdateVehicle should set coverageStatus appropriately based on noCoverage value',
(expectedNoCoverage, expectedCoverageStatus) => {
// Arrange
const vehicle = {
noCoverage: expectedNoCoverage
};
// Act
store.updateVehicle(vehicle);
// Assert
expect(store.order.policy.noCoverage).toBe(expectedNoCoverage);
expect(store.order.payment.insuranceCoverage.coverageStatus).toBe(expectedCoverageStatus);
});
// TODO update test to work also checking store values // TODO update test to work also checking store values
it('setVehicle should call globalMethods.callHttpClient', () => { it('setVehicle should call globalMethods.callHttpClient', () => {
// Arrange // Arrange

View file

@ -1,31 +1,33 @@
process.env.VUE_APP_CONSUMER_CF_DISTRO ="https://digitalapi.dev.safelite.io"; process.env.VUE_APP_CONSUMER_CF_DISTRO = 'https://digitalapi.dev.safelite.io';
process.env.VUE_APP_CURRENT_ENVIRONMENT = "Localhost"; process.env.VUE_APP_CURRENT_ENVIRONMENT = 'Localhost';
process.env.VUE_APP_GOOGLE_PLACES_API_KEY = process.env.VUE_APP_GOOGLE_PLACES_API_KEY
"AIzaSyCuLhQcDdZTTb4JzpUFms1OCch2dk5lHF0"; = 'AIzaSyCuLhQcDdZTTb4JzpUFms1OCch2dk5lHF0';
// GA & GTM // GA & GTM
// NOTE: Using the old ISS site GTM Cotnainer ID for now, will create a new one soon. // NOTE: Using the old ISS site GTM Cotnainer ID for now, will create a new one soon.
process.env.VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY = "(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-KKNWZ3');"; process.env.VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY
process.env.VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC = "https://www.googletagmanager.com/ns.html?id=GTM-KKNWZ3&gtm_auth=amlAYNhxUxuskQo7jmjadg&gtm_preview=env-38&gtm_cookies_win=x"; = "(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-KKNWZ3');";
process.env.VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC
= 'https://www.googletagmanager.com/ns.html?id=GTM-KKNWZ3&gtm_auth=amlAYNhxUxuskQo7jmjadg&gtm_preview=env-38&gtm_cookies_win=x';
module.exports = { module.exports = {
publicPath: "/", publicPath: '/',
css: { css: {
loaderOptions: { loaderOptions: {
sass: { sass: {
// Load Order Matters!!! // Load Order Matters!!!
// Note: only include functions, variables and mixins here // Note: only include functions, variables and mixins here
additionalData: ` additionalData: `
@import "./node_modules/bootstrap/scss/functions"; @import "./node_modules/bootstrap/scss/functions";
@import "@/styles/ux-variables.scss"; @import "@/styles/ux-variables.scss";
@import "./node_modules/bootstrap/scss/variables"; @import "./node_modules/bootstrap/scss/variables";
@import "./node_modules/bootstrap/scss/mixins"; @import "./node_modules/bootstrap/scss/mixins";
@import "@/styles/mixins/customMixins"; @import "@/styles/mixins/customMixins";
` `
} }
} }
}, },
configureWebpack: { configureWebpack: {
devtool: 'source-map' devtool: 'source-map'
} }
}; };