Merge pull request #412 from Safelite/refactor/digital-components
Additional linting and updates. Mostly digital-components.
This commit is contained in:
commit
2ae350d927
23 changed files with 800 additions and 386 deletions
|
|
@ -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': {
|
||||||
|
|
|
||||||
|
|
@ -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
888
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -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"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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}`,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
/**
|
||||||
|
* @module errorMessages
|
||||||
|
* @author T-Wrecks Team
|
||||||
|
* @copyright Safelite
|
||||||
|
*/
|
||||||
const errorMessages = Object.freeze({
|
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',
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,9 @@
|
||||||
/**
|
/**
|
||||||
* @file global-rules.js
|
* @module globalRules
|
||||||
|
* @summary Contains all the globally defined rules.
|
||||||
* @author MB
|
* @author MB
|
||||||
* @copyright Safelite
|
* @copyright Safelite
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @summary Contains all the globally defined rules.
|
|
||||||
*/
|
|
||||||
const globalRules = Object.freeze({
|
const globalRules = Object.freeze({
|
||||||
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',
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
/**
|
||||||
|
* @module states
|
||||||
|
* @author T-Wrecks Team
|
||||||
|
* @copyright Safelite
|
||||||
|
*/
|
||||||
const states = Object.freeze({
|
const states = Object.freeze({
|
||||||
AL: 'Alabama',
|
AL: 'Alabama',
|
||||||
AK: 'Alaska',
|
AK: 'Alaska',
|
||||||
|
|
|
||||||
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -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',
|
||||||
|
|
|
||||||
|
|
@ -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';
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
|
||||||
|
|
@ -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()
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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 };
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
||||||
|
|
|
||||||
|
|
@ -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.'
|
||||||
|
|
|
||||||
|
|
@ -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';
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
|
||||||
|
|
@ -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';
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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>m_auth=amlAYNhxUxuskQo7jmjadg>m_preview=env-38>m_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>m_auth=amlAYNhxUxuskQo7jmjadg>m_preview=env-38>m_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'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue