Merge pull request #423 from Safelite/refactor/mixins
Linting for the last of the layout pages
This commit is contained in:
commit
f5686b9862
59 changed files with 602 additions and 583 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
import { RouterLinkStub } from '@vue/test-utils';
|
import { RouterLinkStub } from '@vue/test-utils';
|
||||||
import { createTestingPinia } from '@pinia/testing';
|
import { createTestingPinia } from '@pinia/testing';
|
||||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios.js';
|
import navigationScenarios from '@/router/router-constants/navigation-scenarios.js';
|
||||||
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';
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import { settleAllPromises } from '@/helpers/layout-helper.js';
|
||||||
import { shallowMount } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
import { useMainStore } from '@/store';
|
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', () => ({
|
jest.mock('@/helpers/damage-helper', () => ({
|
||||||
isGlassAvailableForCarId: jest.fn().mockImplementation(() => true),
|
isGlassAvailableForCarId: jest.fn().mockImplementation(() => true),
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import { shallowMount } from '@vue/test-utils';
|
||||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
import { getRandomString, getRandomInt, getRandomBoolean } from '@/helpers/data-generation.js';
|
import { getRandomString, getRandomInt, getRandomBoolean } from '@/helpers/data-generation.js';
|
||||||
import { createTestingPinia } from '@pinia/testing';
|
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';
|
import { useMainStore } from '@/store/index.js';
|
||||||
|
|
||||||
describe('contactDetails.vue', () => {
|
describe('contactDetails.vue', () => {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import coverageStatement from '@/layouts/coverage-statement/coverage-statement.v
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '@vue/test-utils';
|
||||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
import { createTestingPinia } from '@pinia/testing';
|
import { createTestingPinia } from '@pinia/testing';
|
||||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios.js';
|
import navigationScenarios from '@/router/router-constants/navigation-scenarios.js';
|
||||||
import { getRandomString, getRandomInt } from '@/helpers/data-generation.js';
|
import { getRandomString, getRandomInt } from '@/helpers/data-generation.js';
|
||||||
import { settleAllPromises } from '@/helpers/layout-helper.js';
|
import { settleAllPromises } from '@/helpers/layout-helper.js';
|
||||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ import { useMainStore } from '@/store/index.js';
|
||||||
import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin.js';
|
import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin.js';
|
||||||
import globalRules from '@/constants/global-rules.js';
|
import globalRules from '@/constants/global-rules.js';
|
||||||
import baseFormMixin from '@/mixins/base-form-mixin.js';
|
import baseFormMixin from '@/mixins/base-form-mixin.js';
|
||||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios.js';
|
import navigationScenarios from '@/router/router-constants/navigation-scenarios.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'coverage-statement',
|
name: 'coverage-statement',
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import { settleAllPromises } from '@/helpers/layout-helper.js';
|
||||||
import { shallowMount } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
import { useMainStore } from '@/store';
|
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', () => ({
|
jest.mock('@/helpers/damage-helper', () => ({
|
||||||
isGlassAvailableForCarId: jest.fn().mockImplementation(() => true),
|
isGlassAvailableForCarId: jest.fn().mockImplementation(() => true),
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ 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 { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
import { useMainStore } from '@/store';
|
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.
|
// Mock our module for promises.
|
||||||
jest.mock('@/helpers/layout-helper.js', () => ({
|
jest.mock('@/helpers/layout-helper.js', () => ({
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { shallowMount } from '@vue/test-utils';
|
||||||
import { getMountOptions } from '@/helpers/unit-test-helper';
|
import { getMountOptions } from '@/helpers/unit-test-helper';
|
||||||
import { useMainStore } from '@/store';
|
import { useMainStore } from '@/store';
|
||||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
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';
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { settleAllPromises } from '@/helpers/layout-helper.js';
|
||||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
import { useMainStore } from '@/store';
|
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.
|
// Mock our module for promises.
|
||||||
jest.mock('@/helpers/layout-helper.js', () => ({
|
jest.mock('@/helpers/layout-helper.js', () => ({
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
ref="theForm"
|
ref="theForm"
|
||||||
v-slot="{ meta }"
|
v-slot="{ meta }"
|
||||||
@submit="onSubmit"
|
@submit="onSubmit"
|
||||||
@invalid-submit="onInvalidSubmit">
|
@invalidSubmit="onInvalidSubmit">
|
||||||
<div class="page-container-grouped-styles">
|
<div class="page-container-grouped-styles">
|
||||||
<div class="fade-on-route-transition position-relative">
|
<div class="fade-on-route-transition position-relative">
|
||||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
cmsWidgetName="SiteFooterWidget"
|
cmsWidgetName="SiteFooterWidget"
|
||||||
:isForwardActionDisabled="!meta.valid"
|
:isForwardActionDisabled="!meta.valid"
|
||||||
@ForwardClicked="forwardButtonAction"
|
@ForwardClicked="forwardButtonAction"
|
||||||
@back-clicked="backButtonAction" />
|
@backClicked="backButtonAction" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
// Components
|
// Components
|
||||||
import siteHeader from '@/iss-components/site-header/site-header';
|
import siteHeader from '@/iss-components/site-header/site-header.vue';
|
||||||
import siteFooter from '@/iss-components/site-footer/site-footer';
|
import siteFooter from '@/iss-components/site-footer/site-footer.vue';
|
||||||
// Supporting files
|
// Supporting files
|
||||||
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';
|
||||||
|
|
@ -36,6 +36,7 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
siteHeader,
|
siteHeader,
|
||||||
siteFooter,
|
siteFooter,
|
||||||
|
// eslint-disable-next-line vue/no-reserved-component-names
|
||||||
Form
|
Form
|
||||||
},
|
},
|
||||||
mixins: [BaseFormMixin],
|
mixins: [BaseFormMixin],
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
ref="theForm"
|
ref="theForm"
|
||||||
v-slot="{ meta }"
|
v-slot="{ meta }"
|
||||||
@submit="onSubmit"
|
@submit="onSubmit"
|
||||||
@invalid-submit="onInvalidSubmit">
|
@invalidSubmit="onInvalidSubmit">
|
||||||
<div class="page-container-grouped-styles">
|
<div class="page-container-grouped-styles">
|
||||||
<div class="fade-on-route-transition position-relative">
|
<div class="fade-on-route-transition position-relative">
|
||||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
cmsWidgetName="SiteFooterWidget"
|
cmsWidgetName="SiteFooterWidget"
|
||||||
:isForwardActionDisabled="!meta.valid"
|
:isForwardActionDisabled="!meta.valid"
|
||||||
@ForwardClicked="forwardButtonAction"
|
@ForwardClicked="forwardButtonAction"
|
||||||
@back-clicked="backButtonAction" />
|
@backClicked="backButtonAction" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
// Components
|
// Components
|
||||||
import siteHeader from '@/iss-components/site-header/site-header';
|
import siteHeader from '@/iss-components/site-header/site-header.vue';
|
||||||
import siteFooter from '@/iss-components/site-footer/site-footer';
|
import siteFooter from '@/iss-components/site-footer/site-footer.vue';
|
||||||
// Supporting files
|
// Supporting files
|
||||||
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';
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
ref="theForm"
|
ref="theForm"
|
||||||
v-slot="{ meta }"
|
v-slot="{ meta }"
|
||||||
@submit="onSubmit"
|
@submit="onSubmit"
|
||||||
@invalid-submit="onInvalidSubmit">
|
@invalidSubmit="onInvalidSubmit">
|
||||||
<div class="page-container-grouped-styles">
|
<div class="page-container-grouped-styles">
|
||||||
<div class="fade-on-route-transition position-relative">
|
<div class="fade-on-route-transition position-relative">
|
||||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
cmsWidgetName="SiteFooterWidget"
|
cmsWidgetName="SiteFooterWidget"
|
||||||
:isForwardActionDisabled="!meta.valid"
|
:isForwardActionDisabled="!meta.valid"
|
||||||
@ForwardClicked="forwardButtonAction"
|
@ForwardClicked="forwardButtonAction"
|
||||||
@back-clicked="backButtonAction" />
|
@backClicked="backButtonAction" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
// Components
|
// Components
|
||||||
import siteHeader from '@/iss-components/site-header/site-header';
|
import siteHeader from '@/iss-components/site-header/site-header.vue';
|
||||||
import siteFooter from '@/iss-components/site-footer/site-footer';
|
import siteFooter from '@/iss-components/site-footer/site-footer.vue';
|
||||||
|
|
||||||
// Supporting files
|
// Supporting files
|
||||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||||
|
|
@ -37,6 +37,7 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
siteHeader,
|
siteHeader,
|
||||||
siteFooter,
|
siteFooter,
|
||||||
|
// eslint-disable-next-line vue/no-reserved-component-names
|
||||||
Form
|
Form
|
||||||
},
|
},
|
||||||
mixins: [BaseFormMixin],
|
mixins: [BaseFormMixin],
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,42 @@
|
||||||
import { shallowMount } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
import damageLocationQuestion from '@/layouts/vehicle-damage/damage-location-question/damage-location-question';
|
import damageLocationQuestion from '@/layouts/vehicle-damage/damage-location-question/damage-location-question.vue';
|
||||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
|
|
||||||
|
/** @ignore */
|
||||||
|
function setupMocks({
|
||||||
|
modelValueProp = ['Windshield', 'SideDoor'],
|
||||||
|
isMultiSelect = false,
|
||||||
|
groupName = 'damageQuestion',
|
||||||
|
cmsQuestionText = 'CMS text goes here',
|
||||||
|
cmsAnswers = [{ Name: 'car-Windshield' }, { Name: 'car-SideDoor' }, { Name: 'car-RearWindow' }],
|
||||||
|
dataFromStoreApi = []
|
||||||
|
}) {
|
||||||
|
const mountOptions = getMountOptions({});
|
||||||
|
|
||||||
|
// Mock props
|
||||||
|
const mockMixin = {
|
||||||
|
methods: {
|
||||||
|
getCmsContent: jest.fn()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
mountOptions.propsData = {
|
||||||
|
modelValue: modelValueProp,
|
||||||
|
isMultiSelect
|
||||||
|
};
|
||||||
|
mountOptions.mixins = [mockMixin];
|
||||||
|
|
||||||
|
const wrapper = shallowMount(damageLocationQuestion, mountOptions);
|
||||||
|
|
||||||
|
// Mock CMS content
|
||||||
|
const cmsContent = {
|
||||||
|
groupName,
|
||||||
|
QuestionText: cmsQuestionText,
|
||||||
|
Answers: cmsAnswers
|
||||||
|
};
|
||||||
|
const damageOptions = dataFromStoreApi;
|
||||||
|
return { wrapper, cmsContent, damageOptions };
|
||||||
|
}
|
||||||
|
|
||||||
describe('damage-location-question.vue', () => {
|
describe('damage-location-question.vue', () => {
|
||||||
test('Selected location option is emitted upon selection.', async () => {
|
test('Selected location option is emitted upon selection.', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
@ -45,37 +80,3 @@ describe('damage-location-question.vue', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function setupMocks({
|
|
||||||
modelValueProp = ['Windshield', 'SideDoor'],
|
|
||||||
isMultiSelect = false,
|
|
||||||
groupName = 'damageQuestion',
|
|
||||||
cmsQuestionText = 'CMS text goes here',
|
|
||||||
cmsAnswers = [{ Name: 'car-Windshield' }, { Name: 'car-SideDoor' }, { Name: 'car-RearWindow' }],
|
|
||||||
dataFromStoreApi = []
|
|
||||||
}) {
|
|
||||||
const mountOptions = getMountOptions({});
|
|
||||||
|
|
||||||
// Mock props
|
|
||||||
const mockMixin = {
|
|
||||||
methods: {
|
|
||||||
getCmsContent: jest.fn()
|
|
||||||
}
|
|
||||||
};
|
|
||||||
mountOptions.propsData = {
|
|
||||||
modelValue: modelValueProp,
|
|
||||||
isMultiSelect
|
|
||||||
};
|
|
||||||
mountOptions.mixins = [mockMixin];
|
|
||||||
|
|
||||||
const wrapper = shallowMount(damageLocationQuestion, mountOptions);
|
|
||||||
|
|
||||||
// Mock CMS content
|
|
||||||
const cmsContent = {
|
|
||||||
groupName,
|
|
||||||
QuestionText: cmsQuestionText,
|
|
||||||
Answers: cmsAnswers
|
|
||||||
};
|
|
||||||
const damageOptions = dataFromStoreApi;
|
|
||||||
return { wrapper, cmsContent, damageOptions };
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,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 { 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';
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,52 @@
|
||||||
import { shallowMount } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
import replaceOptionsQuestion from '@/layouts/vehicle-damage/replace-options-question/replace-options-question';
|
import replaceOptionsQuestion from '@/layouts/vehicle-damage/replace-options-question/replace-options-question.vue';
|
||||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
|
|
||||||
|
/** @ignore */
|
||||||
|
function setupMocks({
|
||||||
|
modelValueProp = ['Windshield'],
|
||||||
|
isAvailable = true,
|
||||||
|
isMultiSelect = false,
|
||||||
|
filterByVehicleCategory = false,
|
||||||
|
groupName = 'damageQuestion',
|
||||||
|
cmsQuestionText = 'CMS text goes here',
|
||||||
|
cmsAnswers = [{ Name: 'car-Windshield' }, { Name: 'car-BackDoor' }, { Name: 'car-FrontDoor' }],
|
||||||
|
dataFromStoreApi = [],
|
||||||
|
methodsToMock = []
|
||||||
|
}) {
|
||||||
|
const mountOptions = getMountOptions({});
|
||||||
|
|
||||||
|
// Mock props
|
||||||
|
const mockMixin = {
|
||||||
|
methods: {
|
||||||
|
getCmsContent: jest.fn()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
mountOptions.propsData = {
|
||||||
|
modelValue: modelValueProp,
|
||||||
|
isAvailable,
|
||||||
|
isMultiSelect,
|
||||||
|
filterByVehicleCategory
|
||||||
|
};
|
||||||
|
mountOptions.mixins = [mockMixin];
|
||||||
|
|
||||||
|
// Mock methods
|
||||||
|
methodsToMock.forEach((methodName) => {
|
||||||
|
replaceOptionsQuestion.methods[methodName] = jest.fn();
|
||||||
|
});
|
||||||
|
|
||||||
|
const wrapper = shallowMount(replaceOptionsQuestion, mountOptions);
|
||||||
|
|
||||||
|
// Mock CMS content
|
||||||
|
const cmsContent = {
|
||||||
|
groupName,
|
||||||
|
QuestionText: cmsQuestionText,
|
||||||
|
Answers: cmsAnswers
|
||||||
|
};
|
||||||
|
const replaceOptions = dataFromStoreApi;
|
||||||
|
return { wrapper, cmsContent, replaceOptions };
|
||||||
|
}
|
||||||
|
|
||||||
describe('replace-options-question.vue', () => {
|
describe('replace-options-question.vue', () => {
|
||||||
test('Selected damage option is emitted upon selection.', async () => {
|
test('Selected damage option is emitted upon selection.', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
@ -36,28 +81,29 @@ describe('replace-options-question.vue', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('replace-options-question.vue', () => {
|
describe('replace-options-question.vue', () => {
|
||||||
test('when updateSelectedValues method is called with a single answerToDisplay it will call to update this.selectedReplaceOptions', async () => {
|
test('when updateSelectedValues method is called with a single answerToDisplay it will call to update this.selectedReplaceOptions',
|
||||||
|
async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper, cmsContent, replaceOptions } = setupMocks({
|
const { wrapper, cmsContent, replaceOptions } = setupMocks({
|
||||||
modelValueProp: []
|
modelValueProp: []
|
||||||
});
|
});
|
||||||
wrapper.setData({
|
wrapper.setData({
|
||||||
answersFromCms: [
|
answersFromCms: [
|
||||||
{
|
{
|
||||||
Name: 'Stationary'
|
Name: 'Stationary'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Slider'
|
Name: 'Slider'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
wrapper.setData({ replaceOptions: ['Stationary'] });
|
wrapper.setData({ replaceOptions: ['Stationary'] });
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.$options.methods.updateSelectedValues.call(wrapper.vm);
|
wrapper.vm.$options.methods.updateSelectedValues.call(wrapper.vm);
|
||||||
|
|
||||||
expect(wrapper.vm.selectedValues).toEqual([]);
|
expect(wrapper.vm.selectedValues).toEqual([]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('replace-options-question.vue', () => {
|
describe('replace-options-question.vue', () => {
|
||||||
|
|
@ -80,47 +126,3 @@ describe('replace-options-question.vue', () => {
|
||||||
wrapper.unmount();
|
wrapper.unmount();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function setupMocks({
|
|
||||||
modelValueProp = ['Windshield'],
|
|
||||||
isAvailable = true,
|
|
||||||
isMultiSelect = false,
|
|
||||||
filterByVehicleCategory = false,
|
|
||||||
groupName = 'damageQuestion',
|
|
||||||
cmsQuestionText = 'CMS text goes here',
|
|
||||||
cmsAnswers = [{ Name: 'car-Windshield' }, { Name: 'car-BackDoor' }, { Name: 'car-FrontDoor' }],
|
|
||||||
dataFromStoreApi = [],
|
|
||||||
methodsToMock = []
|
|
||||||
}) {
|
|
||||||
const mountOptions = getMountOptions({ });
|
|
||||||
|
|
||||||
// Mock props
|
|
||||||
const mockMixin = {
|
|
||||||
methods: {
|
|
||||||
getCmsContent: jest.fn()
|
|
||||||
}
|
|
||||||
};
|
|
||||||
mountOptions.propsData = {
|
|
||||||
modelValue: modelValueProp,
|
|
||||||
isAvailable,
|
|
||||||
isMultiSelect,
|
|
||||||
filterByVehicleCategory
|
|
||||||
};
|
|
||||||
mountOptions.mixins = [mockMixin];
|
|
||||||
|
|
||||||
// Mock methods
|
|
||||||
methodsToMock.forEach((methodName) => {
|
|
||||||
replaceOptionsQuestion.methods[methodName] = jest.fn();
|
|
||||||
});
|
|
||||||
|
|
||||||
const wrapper = shallowMount(replaceOptionsQuestion, mountOptions);
|
|
||||||
|
|
||||||
// Mock CMS content
|
|
||||||
const cmsContent = {
|
|
||||||
groupName,
|
|
||||||
QuestionText: cmsQuestionText,
|
|
||||||
Answers: cmsAnswers
|
|
||||||
};
|
|
||||||
const replaceOptions = dataFromStoreApi;
|
|
||||||
return { wrapper, cmsContent, replaceOptions };
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -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';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'replace-options-question',
|
name: 'replace-options-question',
|
||||||
|
|
|
||||||
|
|
@ -1,91 +1,9 @@
|
||||||
import { shallowMount } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
import sideDoorOptions from '@/layouts/vehicle-damage/side-door-options/side-door-options';
|
import sideDoorOptions from '@/layouts/vehicle-damage/side-door-options/side-door-options.vue';
|
||||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
import replaceOptionsQuestion from '@/layouts/vehicle-damage/replace-options-question/replace-options-question';
|
import replaceOptionsQuestion from '@/layouts/vehicle-damage/replace-options-question/replace-options-question.vue';
|
||||||
|
|
||||||
describe('replace-options-question.vue', () => {
|
|
||||||
test('Selected side door option is emitted upon selection.', async () => {
|
|
||||||
// Arrange
|
|
||||||
const { wrapper } = setupMocks({ modelValueProp: ['Windshield'] });
|
|
||||||
const sideDoorOptions = ['Backseat'];
|
|
||||||
|
|
||||||
// Act
|
|
||||||
wrapper.setValue({ modelValue: sideDoorOptions });
|
|
||||||
await wrapper.vm.$nextTick();
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(wrapper.emitted()['update:modelValue'][0]).toEqual([{ modelValue: ['Backseat'] }]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('replace-options-question.vue', () => {
|
|
||||||
test('Selected door side option is updated when selection made.', async () => {
|
|
||||||
// Arrange
|
|
||||||
const { wrapper } = setupMocks({});
|
|
||||||
|
|
||||||
// Act
|
|
||||||
wrapper.vm.selectedDoorSidesValues = ['DriverSide'];
|
|
||||||
await wrapper.vm.$nextTick();
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(wrapper.vm.getSideDoorReplacementOptions()).toHaveBeenCalled;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('replace-options-question.vue', () => {
|
|
||||||
test('Selected driver side option is updated when selection made.', async () => {
|
|
||||||
// Arrange
|
|
||||||
const { wrapper } = setupMocks({});
|
|
||||||
|
|
||||||
// Act
|
|
||||||
wrapper.vm.selectedDriverSideReplaceOptionsValues = ['FrontDoor'];
|
|
||||||
await wrapper.vm.$nextTick();
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(wrapper.vm.getSideDoorReplacementOptions()).toHaveBeenCalled;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('replace-options-question.vue', () => {
|
|
||||||
test('Selected passenger side option is updated when selection made.', async () => {
|
|
||||||
// Arrange
|
|
||||||
const { wrapper } = setupMocks({});
|
|
||||||
|
|
||||||
// Act
|
|
||||||
wrapper.vm.selectedPassengerSideReplaceOptionsValues = ['BacktDoor'];
|
|
||||||
await wrapper.vm.$nextTick();
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(wrapper.vm.getSideDoorReplacementOptions()).toHaveBeenCalled;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('replace-options-question.vue', () => {
|
|
||||||
test('Answers to display filtered by data from api.', async () => {
|
|
||||||
// Arrange
|
|
||||||
const {
|
|
||||||
wrapper,
|
|
||||||
cmsContent,
|
|
||||||
driverSideReplaceOptions,
|
|
||||||
passengerSideReplaceOptions,
|
|
||||||
driverSideOptions,
|
|
||||||
passengerSideOptions
|
|
||||||
} = setupMocks({});
|
|
||||||
|
|
||||||
// Act
|
|
||||||
sideDoorOptions.methods.initializeComponent.call(wrapper.vm,
|
|
||||||
cmsContent,
|
|
||||||
driverSideReplaceOptions,
|
|
||||||
passengerSideReplaceOptions,
|
|
||||||
driverSideOptions,
|
|
||||||
passengerSideOptions,
|
|
||||||
'car-group');
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(wrapper.vm.answersToDisplay).toStrictEqual([]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
/** @ignore */
|
||||||
function setupMocks({
|
function setupMocks({
|
||||||
modelValueProp = ['DriverSide'],
|
modelValueProp = ['DriverSide'],
|
||||||
groupName = 'sideDoorOptions',
|
groupName = 'sideDoorOptions',
|
||||||
|
|
@ -133,3 +51,89 @@ function setupMocks({
|
||||||
passengerSideOptions
|
passengerSideOptions
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
describe('replace-options-question.vue', () => {
|
||||||
|
test('Selected side door option is emitted upon selection.', async () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({ modelValueProp: ['Windshield'] });
|
||||||
|
const sideDoorOptions = ['Backseat'];
|
||||||
|
|
||||||
|
// Act
|
||||||
|
wrapper.setValue({ modelValue: sideDoorOptions });
|
||||||
|
await wrapper.vm.$nextTick();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.emitted()['update:modelValue'][0]).toEqual([{ modelValue: ['Backseat'] }]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: Add () to toHaveBeenCalled and ensure the test passes
|
||||||
|
describe.skip('replace-options-question.vue', () => {
|
||||||
|
test('Selected door side option is updated when selection made.', async () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
wrapper.vm.selectedDoorSidesValues = ['DriverSide'];
|
||||||
|
await wrapper.vm.$nextTick();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.getSideDoorReplacementOptions()).toHaveBeenCalled;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: Add () to toHaveBeenCalled and ensure the test passes
|
||||||
|
describe.skip('replace-options-question.vue', () => {
|
||||||
|
test('Selected driver side option is updated when selection made.', async () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
wrapper.vm.selectedDriverSideReplaceOptionsValues = ['FrontDoor'];
|
||||||
|
await wrapper.vm.$nextTick();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.getSideDoorReplacementOptions()).toHaveBeenCalled;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: Add () to toHaveBeenCalled and ensure the test passes
|
||||||
|
describe.skip('replace-options-question.vue', () => {
|
||||||
|
test('Selected passenger side option is updated when selection made.', async () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
wrapper.vm.selectedPassengerSideReplaceOptionsValues = ['BacktDoor'];
|
||||||
|
await wrapper.vm.$nextTick();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.getSideDoorReplacementOptions()).toHaveBeenCalled;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('replace-options-question.vue', () => {
|
||||||
|
test('Answers to display filtered by data from api.', async () => {
|
||||||
|
// Arrange
|
||||||
|
const {
|
||||||
|
wrapper,
|
||||||
|
cmsContent,
|
||||||
|
driverSideReplaceOptions,
|
||||||
|
passengerSideReplaceOptions,
|
||||||
|
driverSideOptions,
|
||||||
|
passengerSideOptions
|
||||||
|
} = setupMocks({});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
sideDoorOptions.methods.initializeComponent.call(wrapper.vm,
|
||||||
|
cmsContent,
|
||||||
|
driverSideReplaceOptions,
|
||||||
|
passengerSideReplaceOptions,
|
||||||
|
driverSideOptions,
|
||||||
|
passengerSideOptions,
|
||||||
|
'car-group');
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.answersToDisplay).toStrictEqual([]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import buttonQuestion from '@/digital-components/button-question/button-question';
|
import buttonQuestion from '@/digital-components/button-question/button-question.vue';
|
||||||
import replaceOptionsQuestion from '@/layouts/vehicle-damage/replace-options-question/replace-options-question';
|
import replaceOptionsQuestion from '@/layouts/vehicle-damage/replace-options-question/replace-options-question.vue';
|
||||||
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';
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/* eslint-env jest */
|
/* eslint-env jest */
|
||||||
import { mount, flushPromises } from '@vue/test-utils';
|
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-constants/router-params';
|
import routerParams from '@/router/router-constants/router-params';
|
||||||
import vehicleCategories from '@/constants/vehicle-categories';
|
import vehicleCategories from '@/constants/vehicle-categories';
|
||||||
import VehicleDamageComponent from '@/layouts/vehicle-damage/vehicle-damage.vue';
|
import VehicleDamageComponent from '@/layouts/vehicle-damage/vehicle-damage.vue';
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
ref="theForm"
|
ref="theForm"
|
||||||
v-slot="{ meta }"
|
v-slot="{ meta }"
|
||||||
@submit="onSubmit"
|
@submit="onSubmit"
|
||||||
@invalid-submit="onInvalidSubmit">
|
@invalidSubmit="onInvalidSubmit">
|
||||||
<div class="page-container-grouped-styles">
|
<div class="page-container-grouped-styles">
|
||||||
<div class="fade-on-route-transition position-relative">
|
<div class="fade-on-route-transition position-relative">
|
||||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||||
|
|
@ -72,15 +72,15 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Components
|
// Components
|
||||||
import siteHeader from '@/iss-components/site-header/site-header';
|
import siteHeader from '@/iss-components/site-header/site-header.vue';
|
||||||
import siteFooter from '@/iss-components/site-footer/site-footer';
|
import siteFooter from '@/iss-components/site-footer/site-footer.vue';
|
||||||
import vehicleBanner from '@/iss-components/vehicle-banner/vehicle-banner';
|
import vehicleBanner from '@/iss-components/vehicle-banner/vehicle-banner.vue';
|
||||||
import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header';
|
import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header.vue';
|
||||||
import sideDoorOptions from '@/layouts/vehicle-damage/side-door-options/side-door-options';
|
import sideDoorOptions from '@/layouts/vehicle-damage/side-door-options/side-door-options.vue';
|
||||||
import damageLocationQuestion from '@/layouts/vehicle-damage/damage-location-question/damage-location-question';
|
import damageLocationQuestion from '@/layouts/vehicle-damage/damage-location-question/damage-location-question.vue';
|
||||||
import windshieldOptions from '@/layouts/vehicle-damage/windshield-options/windshield-options';
|
import windshieldOptions from '@/layouts/vehicle-damage/windshield-options/windshield-options.vue';
|
||||||
import replaceOptionsQuestion from '@/layouts/vehicle-damage/replace-options-question/replace-options-question';
|
import replaceOptionsQuestion from '@/layouts/vehicle-damage/replace-options-question/replace-options-question.vue';
|
||||||
import alert from '@/ux-components/alert/alert';
|
import alert from '@/ux-components/alert/alert.vue';
|
||||||
|
|
||||||
// Supporting files
|
// Supporting files
|
||||||
import BaseFormMixin from '@/mixins/base-form-mixin.js';
|
import BaseFormMixin from '@/mixins/base-form-mixin.js';
|
||||||
|
|
@ -285,8 +285,7 @@ export default {
|
||||||
&& glass.glassName === damageLocationsSelected.SINGLE
|
&& glass.glassName === damageLocationsSelected.SINGLE
|
||||||
))
|
))
|
||||||
) {
|
) {
|
||||||
windShieldOptions.selectedWindshieldDamageType
|
windShieldOptions.selectedWindshieldDamageType = damageLocationsSelected.REPLACE;
|
||||||
= damageLocationsSelected.REPLACE;
|
|
||||||
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.SINGLE);
|
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.SINGLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -296,8 +295,7 @@ export default {
|
||||||
&& glass.glassName === damageLocationsSelected.DRIVER
|
&& glass.glassName === damageLocationsSelected.DRIVER
|
||||||
))
|
))
|
||||||
) {
|
) {
|
||||||
windShieldOptions.selectedWindshieldDamageType
|
windShieldOptions.selectedWindshieldDamageType = damageLocationsSelected.REPLACE;
|
||||||
= damageLocationsSelected.REPLACE;
|
|
||||||
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.DRIVER);
|
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.DRIVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -307,8 +305,7 @@ export default {
|
||||||
&& glass.glassName === damageLocationsSelected.PASSENGER
|
&& glass.glassName === damageLocationsSelected.PASSENGER
|
||||||
))
|
))
|
||||||
) {
|
) {
|
||||||
windShieldOptions.selectedWindshieldDamageType
|
windShieldOptions.selectedWindshieldDamageType = damageLocationsSelected.REPLACE;
|
||||||
= damageLocationsSelected.REPLACE;
|
|
||||||
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.PASSENGER);
|
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.PASSENGER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,9 @@
|
||||||
import { shallowMount } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
import windshieldChipCountQuestion from '@/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question';
|
// eslint-disable-next-line max-len
|
||||||
|
import windshieldChipCountQuestion from '@/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue';
|
||||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
|
|
||||||
describe('windshield-chip-count-question.vue', () => {
|
/** @ignore */
|
||||||
test('Selected chip count is emitted upon selection.', async () => {
|
|
||||||
// Arrange
|
|
||||||
const { wrapper } = setupMocks({ modelValueProp: 1 });
|
|
||||||
|
|
||||||
// Act
|
|
||||||
wrapper.vm.selectedValue = '2';
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(wrapper.emitted()['update:modelValue'][0]).toEqual([2]);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('selectedValue matches modelValue', () => {
|
|
||||||
// Arrange/Act
|
|
||||||
const { wrapper } = setupMocks({ modelValueProp: 2 });
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(wrapper.vm.selectedValue).toBe(2);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function setupMocks({
|
function setupMocks({
|
||||||
modelValueProp = ['Two'],
|
modelValueProp = ['Two'],
|
||||||
groupName = 'WindshieldChipCountQuestion',
|
groupName = 'WindshieldChipCountQuestion',
|
||||||
|
|
@ -55,3 +36,24 @@ function setupMocks({
|
||||||
const damageOptions = dataFromStoreApi;
|
const damageOptions = dataFromStoreApi;
|
||||||
return { wrapper, cmsContent, damageOptions };
|
return { wrapper, cmsContent, damageOptions };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
describe('windshield-chip-count-question.vue', () => {
|
||||||
|
test('Selected chip count is emitted upon selection.', async () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({ modelValueProp: 1 });
|
||||||
|
|
||||||
|
// Act
|
||||||
|
wrapper.vm.selectedValue = '2';
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.emitted()['update:modelValue'][0]).toEqual([2]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('selectedValue matches modelValue', () => {
|
||||||
|
// Arrange/Act
|
||||||
|
const { wrapper } = setupMocks({ modelValueProp: 2 });
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.selectedValue).toBe(2);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import buttonQuestion from '@/digital-components/button-question/button-question';
|
import buttonQuestion from '@/digital-components/button-question/button-question.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'windshield-options',
|
name: 'windshield-options',
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,9 @@
|
||||||
import { shallowMount } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
import windshieldDamageTypeQuestion from '@/layouts/vehicle-damage/windshield-options/windshield-damage-type-question/windshield-damage-type-question';
|
// eslint-disable-next-line max-len
|
||||||
|
import windshieldDamageTypeQuestion from '@/layouts/vehicle-damage/windshield-options/windshield-damage-type-question/windshield-damage-type-question.vue';
|
||||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
|
|
||||||
describe('windshield-damage-type-question.vue', () => {
|
/** @ignore */
|
||||||
test('Selected windshield damage is emitted upon selection.', async () => {
|
|
||||||
// Arrange
|
|
||||||
const { wrapper } = setupMocks({ modelValueProp: 'Repair' });
|
|
||||||
|
|
||||||
// Act
|
|
||||||
wrapper.setValue({ modelValue: 'Replace' });
|
|
||||||
await wrapper.vm.$nextTick();
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(wrapper.vm.selectedValues).toEqual('Repair');
|
|
||||||
expect(wrapper.emitted()['update:modelValue'][0]).toEqual([{ modelValue: 'Replace' }]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function setupMocks({
|
function setupMocks({
|
||||||
modelValueProp = '',
|
modelValueProp = '',
|
||||||
groupName = 'WindshieldDamageTypeQuestion',
|
groupName = 'WindshieldDamageTypeQuestion',
|
||||||
|
|
@ -42,10 +29,25 @@ function setupMocks({
|
||||||
|
|
||||||
// Mock CMS content
|
// Mock CMS content
|
||||||
const cmsContent = {
|
const cmsContent = {
|
||||||
groupName: groupName,
|
groupName,
|
||||||
QuestionText: cmsQuestionText,
|
QuestionText: cmsQuestionText,
|
||||||
Answers: cmsAnswers
|
Answers: cmsAnswers
|
||||||
};
|
};
|
||||||
const damageOptions = dataFromStoreApi;
|
const damageOptions = dataFromStoreApi;
|
||||||
return { wrapper, cmsContent, damageOptions };
|
return { wrapper, cmsContent, damageOptions };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
describe('windshield-damage-type-question.vue', () => {
|
||||||
|
test('Selected windshield damage is emitted upon selection.', async () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({ modelValueProp: 'Repair' });
|
||||||
|
|
||||||
|
// Act
|
||||||
|
wrapper.setValue({ modelValue: 'Replace' });
|
||||||
|
await wrapper.vm.$nextTick();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.selectedValues).toEqual('Repair');
|
||||||
|
expect(wrapper.emitted()['update:modelValue'][0]).toEqual([{ modelValue: 'Replace' }]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import buttonQuestion from '@/digital-components/button-question/button-question';
|
import buttonQuestion from '@/digital-components/button-question/button-question.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'windshield-damage-type-question',
|
name: 'windshield-damage-type-question',
|
||||||
|
|
|
||||||
|
|
@ -40,11 +40,11 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import windshieldDamageTypeQuestion from
|
import windshieldDamageTypeQuestion from
|
||||||
'@/layouts/vehicle-damage/windshield-options/windshield-damage-type-question/windshield-damage-type-question';
|
'@/layouts/vehicle-damage/windshield-options/windshield-damage-type-question/windshield-damage-type-question.vue';
|
||||||
import windshieldChipCountQuestion from
|
import windshieldChipCountQuestion from
|
||||||
'@/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question';
|
'@/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue';
|
||||||
import replaceOptionsQuestion from '@/layouts/vehicle-damage/replace-options-question/replace-options-question';
|
import replaceOptionsQuestion from '@/layouts/vehicle-damage/replace-options-question/replace-options-question.vue';
|
||||||
import alert from '@/ux-components/alert/alert';
|
import alert from '@/ux-components/alert/alert.vue';
|
||||||
|
|
||||||
import { defineRule } from 'vee-validate';
|
import { defineRule } from 'vee-validate';
|
||||||
import { required } from '@/helpers/validation-rules';
|
import { required } from '@/helpers/validation-rules';
|
||||||
|
|
@ -182,8 +182,8 @@ export default {
|
||||||
},
|
},
|
||||||
windshieldDamageTypeQuestionValidationRules() {
|
windshieldDamageTypeQuestionValidationRules() {
|
||||||
// Note: the validation rules string is not dynamic (it cannot be changed once component has been created)
|
// Note: the validation rules string is not dynamic (it cannot be changed once component has been created)
|
||||||
let validationRules
|
let validationRules =
|
||||||
= 'windshield-damage-type-required|check-for-repair-and-replace:@DamageLocationQuestion';
|
'windshield-damage-type-required|check-for-repair-and-replace:@DamageLocationQuestion';
|
||||||
// if vehicle has no windshield replacement option
|
// if vehicle has no windshield replacement option
|
||||||
if (!this.isWindshieldReplaceAvailable) {
|
if (!this.isWindshieldReplaceAvailable) {
|
||||||
validationRules = validationRules.concat('|repair-only');
|
validationRules = validationRules.concat('|repair-only');
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/* 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';
|
||||||
|
|
@ -11,7 +11,7 @@ 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.vue';
|
||||||
|
|
||||||
const pinia = createTestingPinia();
|
const pinia = createTestingPinia();
|
||||||
useMainStore(pinia);
|
useMainStore(pinia);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<Form
|
<Form
|
||||||
@submit="onSubmit"
|
@submit="onSubmit"
|
||||||
@invalid-submit="onInvalidSubmit">
|
@invalidSubmit="onInvalidSubmit">
|
||||||
<div class="page-container-grouped-styles">
|
<div class="page-container-grouped-styles">
|
||||||
<div class="fade-on-route-transition position-relative">
|
<div class="fade-on-route-transition position-relative">
|
||||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||||
|
|
@ -26,8 +26,8 @@
|
||||||
cmsWidgetName="SiteFooterWidget"
|
cmsWidgetName="SiteFooterWidget"
|
||||||
:isForwardActionDisabled="isForwardActionDisabled"
|
:isForwardActionDisabled="isForwardActionDisabled"
|
||||||
class="mt-5"
|
class="mt-5"
|
||||||
@back-clicked="backButtonAction"
|
@backClicked="backButtonAction"
|
||||||
@forward-clicked="forwardButtonAction" />
|
@forwardClicked="forwardButtonAction" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -44,14 +44,13 @@ 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 Component
|
// Import Component
|
||||||
import SiteFooter from '@/iss-components/site-footer/site-footer';
|
import SiteFooter from '@/iss-components/site-footer/site-footer.vue';
|
||||||
import SiteHeader from '@/iss-components/site-header/site-header';
|
import SiteHeader from '@/iss-components/site-header/site-header.vue';
|
||||||
import SiteSubHeader from '@/iss-components/site-sub-header/site-sub-header';
|
import SiteSubHeader from '@/iss-components/site-sub-header/site-sub-header.vue';
|
||||||
import VehicleBanner from '@/iss-components/vehicle-banner/vehicle-banner';
|
import VehicleBanner from '@/iss-components/vehicle-banner/vehicle-banner.vue';
|
||||||
import VinLookupMethods from '@/layouts/vehicle-lookup/vin-lookup-methods/vin-lookup-methods';
|
import VinLookupMethods from '@/layouts/vehicle-lookup/vin-lookup-methods/vin-lookup-methods.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'vehicle-lookup',
|
name: 'vehicle-lookup',
|
||||||
|
|
@ -105,17 +104,17 @@ export default {
|
||||||
},
|
},
|
||||||
forwardButtonAction() {
|
forwardButtonAction() {
|
||||||
switch (this.selectedVinLookupMethod) {
|
switch (this.selectedVinLookupMethod) {
|
||||||
case vinLookupMethodSelections.MANUALVIN:
|
case vinLookupMethodSelections.MANUALVIN:
|
||||||
this.$router.navigate(this.navigationScenarios.SELECTED_MANUAL_VIN, this.$route);
|
this.$router.navigate(this.navigationScenarios.SELECTED_MANUAL_VIN, this.$route);
|
||||||
break;
|
break;
|
||||||
case vinLookupMethodSelections.LICENSEPLATE:
|
case vinLookupMethodSelections.LICENSEPLATE:
|
||||||
this.$router.navigate(this.navigationScenarios.SELECTED_LICENSE_PLATE, this.$route);
|
this.$router.navigate(this.navigationScenarios.SELECTED_LICENSE_PLATE, this.$route);
|
||||||
break;
|
break;
|
||||||
case vinLookupMethodSelections.HOMEADDRESS:
|
case vinLookupMethodSelections.HOMEADDRESS:
|
||||||
this.$router.navigate(this.navigationScenarios.SELECTED_HOME_ADDRESS, this.$route);
|
this.$router.navigate(this.navigationScenarios.SELECTED_HOME_ADDRESS, this.$route);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
resetDependentState() {}
|
resetDependentState() {}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import { settleAllPromises } from '@/helpers/layout-helper';
|
||||||
import globalRules from '@/constants/global-rules';
|
import globalRules from '@/constants/global-rules';
|
||||||
|
|
||||||
// Import Component
|
// Import Component
|
||||||
import ButtonQuestion from '@/digital-components/button-question/button-question';
|
import ButtonQuestion from '@/digital-components/button-question/button-question.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'vin-lookup-methods',
|
name: 'vin-lookup-methods',
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { shallowMount } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
import glassPartQuestion from '@/layouts/vehicle-parts/glass-part-question/glass-part-question';
|
import glassPartQuestion from '@/layouts/vehicle-parts/glass-part-question/glass-part-question.vue';
|
||||||
import { useMainStore } from '@/store';
|
import { useMainStore } from '@/store';
|
||||||
|
|
||||||
const featureListData = {
|
const featureListData = {
|
||||||
|
|
@ -23,6 +23,34 @@ const featureListData = {
|
||||||
modelValueProp: {}
|
modelValueProp: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** @ignore */
|
||||||
|
function setupMocks({ glassNameProp, glassLocationProp, colorAnswersProp, modelValueProp, pageData }) {
|
||||||
|
const mountOptions = getMountOptions({
|
||||||
|
route: {
|
||||||
|
query: {
|
||||||
|
issPage: 'vehicle-parts'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mountOptions.propsData = {
|
||||||
|
glassName: glassNameProp,
|
||||||
|
glassLocation: glassLocationProp,
|
||||||
|
colorAnswers: colorAnswersProp,
|
||||||
|
modelValue: modelValueProp
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
const wrapper = shallowMount(glassPartQuestion, mountOptions);
|
||||||
|
|
||||||
|
// Mock store
|
||||||
|
const partsOrQuestions = pageData ?? { partsOrQuestions: [{ glassName: 'Stationary', glassLocation: 'Rear', parts: [] }] };
|
||||||
|
useMainStore().pageData = jest.fn();
|
||||||
|
useMainStore().pageData.mockReturnValue(partsOrQuestions);
|
||||||
|
document.querySelector = jest.fn().mockReturnValue({ clicked: false, click: jest.fn() });
|
||||||
|
return { wrapper };
|
||||||
|
}
|
||||||
|
|
||||||
describe('glass-part-question.vue', () => {
|
describe('glass-part-question.vue', () => {
|
||||||
test('Part data passed in, should map data for ButtonQuestion (radio type)', async () => {
|
test('Part data passed in, should map data for ButtonQuestion (radio type)', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
@ -31,7 +59,7 @@ describe('glass-part-question.vue', () => {
|
||||||
// Act
|
// Act
|
||||||
await wrapper.vm.$nextTick();
|
await wrapper.vm.$nextTick();
|
||||||
|
|
||||||
console.log(wrapper.vm.featureListData['Green Tint'][0].Text);
|
window.console.log(wrapper.vm.featureListData['Green Tint'][0].Text);
|
||||||
// Assert
|
// Assert
|
||||||
expect(Object.keys(wrapper.vm.featureListData).length).toBe(2);
|
expect(Object.keys(wrapper.vm.featureListData).length).toBe(2);
|
||||||
expect(wrapper.vm.featureListData['Green Tint'][0].Text).toBe('heated glass, solar, 1 hole');
|
expect(wrapper.vm.featureListData['Green Tint'][0].Text).toBe('heated glass, solar, 1 hole');
|
||||||
|
|
@ -197,30 +225,3 @@ describe('glass-part-question.vue', () => {
|
||||||
expect(expectedResults).toEqual(wrapper.vm.partsForSelectedTint);
|
expect(expectedResults).toEqual(wrapper.vm.partsForSelectedTint);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function setupMocks({ glassNameProp, glassLocationProp, colorAnswersProp, modelValueProp, pageData }) {
|
|
||||||
const mountOptions = getMountOptions({
|
|
||||||
route: {
|
|
||||||
query: {
|
|
||||||
issPage: 'vehicle-parts'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mountOptions.propsData = {
|
|
||||||
glassName: glassNameProp,
|
|
||||||
glassLocation: glassLocationProp,
|
|
||||||
colorAnswers: colorAnswersProp,
|
|
||||||
modelValue: modelValueProp
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
const wrapper = shallowMount(glassPartQuestion, mountOptions);
|
|
||||||
|
|
||||||
// Mock store
|
|
||||||
const partsOrQuestions = pageData ?? { partsOrQuestions: [{ glassName: 'Stationary', glassLocation: 'Rear', parts: [] }] };
|
|
||||||
useMainStore().pageData = jest.fn();
|
|
||||||
useMainStore().pageData.mockReturnValue(partsOrQuestions);
|
|
||||||
document.querySelector = jest.fn().mockReturnValue({ clicked: false, click: jest.fn() });
|
|
||||||
return { wrapper };
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Components
|
// Components
|
||||||
import buttonQuestion from '@/digital-components/button-question/button-question';
|
import buttonQuestion from '@/digital-components/button-question/button-question.vue';
|
||||||
|
|
||||||
// Supporting files
|
// Supporting files
|
||||||
import getTintImage from '@/constants/tint-mapper';
|
import getTintImage from '@/constants/tint-mapper';
|
||||||
|
|
@ -102,8 +102,7 @@ export default {
|
||||||
tintOptions.push({
|
tintOptions.push({
|
||||||
value: tintOption,
|
value: tintOption,
|
||||||
buttonLabel: tintOption,
|
buttonLabel: tintOption,
|
||||||
buttonImage: require(`@/assets/img/tints/${this.getTintSourceImage(this.glassLocation,
|
buttonImage: require(`@/assets/img/tints/${this.getTintSourceImage(this.glassLocation, tintOption)}`)
|
||||||
tintOption)}`)
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// Components
|
// Components
|
||||||
import vehicleParts from '@/layouts/vehicle-parts/vehicle-parts';
|
import vehicleParts from '@/layouts/vehicle-parts/vehicle-parts.vue';
|
||||||
import glassPartQuestion from '@/layouts/vehicle-parts/glass-part-question/glass-part-question';
|
import glassPartQuestion from '@/layouts/vehicle-parts/glass-part-question/glass-part-question.vue';
|
||||||
|
|
||||||
// Supporting Files
|
// Supporting Files
|
||||||
import { settleAllPromises } from '@/helpers/layout-helper.js';
|
import { settleAllPromises } from '@/helpers/layout-helper.js';
|
||||||
|
|
@ -10,7 +10,7 @@ import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
import { nextTick } from 'vue';
|
import { nextTick } from 'vue';
|
||||||
import baseMixin from '@/mixins/base-mixin.js';
|
import baseMixin from '@/mixins/base-mixin.js';
|
||||||
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 applicationConfig from '@/constants/application-config';
|
import applicationConfig from '@/constants/application-config';
|
||||||
|
|
||||||
// Mock our module for promises.
|
// Mock our module for promises.
|
||||||
|
|
@ -58,6 +58,50 @@ const basePartResponse = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** @ignore */
|
||||||
|
function setupMocks({ pageHeaderWidgetHeaderText = {}, mountOptionsMockData = {} }) {
|
||||||
|
// Mock api responses
|
||||||
|
const apiResponses = {
|
||||||
|
cmsContent: {
|
||||||
|
SiteSubHeaderWidget: pageHeaderWidgetHeaderText,
|
||||||
|
VehicleBannerWidget: {
|
||||||
|
GenericVehicleImage:
|
||||||
|
`${applicationConfig.ISS_DEV_CMS_DOMAIN}/images/default-source/default-album/blurred-image.jpg`
|
||||||
|
},
|
||||||
|
FunnelHeaderWidget: {
|
||||||
|
LogoImage:
|
||||||
|
`${applicationConfig.ISS_DEV_CMS_DOMAIN}/images/default-source/default-album/logos/insuranceLogo.jpg`
|
||||||
|
},
|
||||||
|
ColorQuestionWidget: 'Please choose your rear window tint color',
|
||||||
|
FeatureQuestionWidget: 'Ok no choose features',
|
||||||
|
AlertWidget: {
|
||||||
|
BodyText: 'Please choose your tint color',
|
||||||
|
HeadlineText: 'Just a few more steps to go'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const store = useMainStore();
|
||||||
|
const actionResult = [];
|
||||||
|
store.getCapabilityQuestions.mockImplementation(() => Promise.resolve({ data: actionResult }));
|
||||||
|
|
||||||
|
const apiPromise = Promise.resolve(apiResponses);
|
||||||
|
|
||||||
|
settleAllPromises.mockImplementation(() => apiPromise);
|
||||||
|
fetchCmsContentForPage.mockImplementation(() => Promise.resolve());
|
||||||
|
|
||||||
|
const mountOptions = getMountOptions(mountOptionsMockData);
|
||||||
|
const wrapper = shallowMount(vehicleParts, mountOptions);
|
||||||
|
|
||||||
|
const partQuestionRearWrapper = wrapper.findComponent({ name: 'glassPartQuestion' });
|
||||||
|
partQuestionRearWrapper.vm.initializeComponent = glassPartQuestion.methods.initializeComponent;
|
||||||
|
|
||||||
|
wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent;
|
||||||
|
wrapper.vm.$refs.siteFooter.removeLoader = jest.fn();
|
||||||
|
|
||||||
|
return { wrapper, apiPromise };
|
||||||
|
}
|
||||||
|
|
||||||
describe('vehicle-parts.vue', () => {
|
describe('vehicle-parts.vue', () => {
|
||||||
test('Set cms content called on load', async () => {
|
test('Set cms content called on load', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
@ -295,7 +339,12 @@ describe('vehicle-parts.vue', () => {
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
|
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
|
||||||
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith('CLICKED_FORWARD_WITH_MOLDING_QUESTIONS', { query: { issPage: 'vehicle-parts' } }, {}, {}, expect.anything());
|
expect(wrapper.vm.$router.navigate)
|
||||||
|
.toHaveBeenCalledWith('CLICKED_FORWARD_WITH_MOLDING_QUESTIONS',
|
||||||
|
{ query: { issPage: 'vehicle-parts' } },
|
||||||
|
{},
|
||||||
|
{},
|
||||||
|
expect.anything());
|
||||||
});
|
});
|
||||||
|
|
||||||
test('ForwardButtonAction triggers a router.navigate change if there are capability questions', async () => {
|
test('ForwardButtonAction triggers a router.navigate change if there are capability questions', async () => {
|
||||||
|
|
@ -356,49 +405,10 @@ describe('vehicle-parts.vue', () => {
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
|
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
|
||||||
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith('CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS', { query: { issPage: 'vehicle-parts' } }, {}, {}, expect.anything());
|
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith('CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS',
|
||||||
|
{ query: { issPage: 'vehicle-parts' } },
|
||||||
|
{},
|
||||||
|
{},
|
||||||
|
expect.anything());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function setupMocks({ pageHeaderWidgetHeaderText = {}, mountOptionsMockData = {} }) {
|
|
||||||
// Mock api responses
|
|
||||||
const apiResponses = {
|
|
||||||
cmsContent: {
|
|
||||||
SiteSubHeaderWidget: pageHeaderWidgetHeaderText,
|
|
||||||
VehicleBannerWidget: {
|
|
||||||
GenericVehicleImage:
|
|
||||||
`${applicationConfig.ISS_DEV_CMS_DOMAIN}/images/default-source/default-album/blurred-image.jpg`
|
|
||||||
},
|
|
||||||
FunnelHeaderWidget: {
|
|
||||||
LogoImage:
|
|
||||||
`${applicationConfig.ISS_DEV_CMS_DOMAIN}/images/default-source/default-album/logos/insuranceLogo.jpg`
|
|
||||||
},
|
|
||||||
ColorQuestionWidget: 'Please choose your rear window tint color',
|
|
||||||
FeatureQuestionWidget: 'Ok no choose features',
|
|
||||||
AlertWidget: {
|
|
||||||
BodyText: 'Please choose your tint color',
|
|
||||||
HeadlineText: 'Just a few more steps to go'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const store = useMainStore();
|
|
||||||
const actionResult = [];
|
|
||||||
store.getCapabilityQuestions.mockImplementation(() => Promise.resolve({ data: actionResult }));
|
|
||||||
|
|
||||||
const apiPromise = Promise.resolve(apiResponses);
|
|
||||||
|
|
||||||
settleAllPromises.mockImplementation(() => apiPromise);
|
|
||||||
fetchCmsContentForPage.mockImplementation(() => Promise.resolve());
|
|
||||||
|
|
||||||
const mountOptions = getMountOptions(mountOptionsMockData);
|
|
||||||
const wrapper = shallowMount(vehicleParts, mountOptions);
|
|
||||||
|
|
||||||
const partQuestionRearWrapper = wrapper.findComponent({ name: 'glassPartQuestion' });
|
|
||||||
partQuestionRearWrapper.vm.initializeComponent = glassPartQuestion.methods.initializeComponent;
|
|
||||||
|
|
||||||
wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent;
|
|
||||||
wrapper.vm.$refs.siteFooter.removeLoader = jest.fn();
|
|
||||||
|
|
||||||
return { wrapper, apiPromise };
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<Form
|
<Form
|
||||||
ref="theForm"
|
ref="theForm"
|
||||||
@submit="onSubmit"
|
@submit="onSubmit"
|
||||||
@invalid-submit="onInvalidSubmit">
|
@invalidSubmit="onInvalidSubmit">
|
||||||
<div class="page-container-grouped-styles">
|
<div class="page-container-grouped-styles">
|
||||||
<div class="fade-on-route-transition position-relative">
|
<div class="fade-on-route-transition position-relative">
|
||||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||||
|
|
@ -187,7 +187,9 @@ export default {
|
||||||
const matchedParts = [];
|
const matchedParts = [];
|
||||||
|
|
||||||
// Match them to the parts from the API.
|
// Match them to the parts from the API.
|
||||||
|
// eslint-disable-next-line no-restricted-syntax
|
||||||
for (const [key, value] of Object.entries(this.PartsFromApi.partsOrQuestions)) {
|
for (const [key, value] of Object.entries(this.PartsFromApi.partsOrQuestions)) {
|
||||||
|
// eslint-disable-next-line no-restricted-syntax
|
||||||
for (const [partKey, partValue] of Object.entries(value.parts)) {
|
for (const [partKey, partValue] of Object.entries(value.parts)) {
|
||||||
const currentPart = this.PartsFromApi.partsOrQuestions[key].parts[partKey];
|
const currentPart = this.PartsFromApi.partsOrQuestions[key].parts[partKey];
|
||||||
|
|
||||||
|
|
@ -213,10 +215,9 @@ export default {
|
||||||
|
|
||||||
LoadInitialPartsData() {
|
LoadInitialPartsData() {
|
||||||
const partsData = this.PartsFromApi;
|
const partsData = this.PartsFromApi;
|
||||||
this.alreadyPopulatedPartsData
|
this.alreadyPopulatedPartsData = this.mainStore.lineItems.glassParts === null
|
||||||
= this.mainStore.lineItems.glassParts === null
|
? []
|
||||||
? []
|
: this.mainStore.lineItems.glassParts;
|
||||||
: this.mainStore.lineItems.glassParts;
|
|
||||||
|
|
||||||
partsData.partsOrQuestions.map((g) => {
|
partsData.partsOrQuestions.map((g) => {
|
||||||
// If the part is already populated, use the value from the store and populate the v-model.
|
// If the part is already populated, use the value from the store and populate the v-model.
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import dropdownQuestion from '@/digital-components/dropdown-question/dropdown-question';
|
import dropdownQuestion from '@/digital-components/dropdown-question/dropdown-question.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'vehicle-question',
|
name: 'vehicle-question',
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
ref="theForm"
|
ref="theForm"
|
||||||
v-slot="{ meta }"
|
v-slot="{ meta }"
|
||||||
@submit="onSubmit"
|
@submit="onSubmit"
|
||||||
@invalid-submit="onInvalidSubmit">
|
@invalidSubmit="onInvalidSubmit">
|
||||||
<div class="page-container-grouped-styles position-relative">
|
<div class="page-container-grouped-styles position-relative">
|
||||||
<div class="fade-on-route-transition position-relative">
|
<div class="fade-on-route-transition position-relative">
|
||||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
cmsWidgetName="SiteFooterWidget"
|
cmsWidgetName="SiteFooterWidget"
|
||||||
:isForwardActionDisabled="!meta.valid"
|
:isForwardActionDisabled="!meta.valid"
|
||||||
@ForwardClicked="forwardButtonAction"
|
@ForwardClicked="forwardButtonAction"
|
||||||
@back-clicked="backButtonAction" />
|
@backClicked="backButtonAction" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -76,11 +76,11 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Components
|
// Components
|
||||||
import siteHeader from '@/iss-components/site-header/site-header';
|
import siteHeader from '@/iss-components/site-header/site-header.vue';
|
||||||
import siteFooter from '@/iss-components/site-footer/site-footer';
|
import siteFooter from '@/iss-components/site-footer/site-footer.vue';
|
||||||
import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header';
|
import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header.vue';
|
||||||
import vehicleBanner from '@/iss-components/vehicle-banner/vehicle-banner';
|
import vehicleBanner from '@/iss-components/vehicle-banner/vehicle-banner.vue';
|
||||||
import vehicleQuestion from '@/layouts/vehicle-selection/vehicle-question/vehicle-question';
|
import vehicleQuestion from '@/layouts/vehicle-selection/vehicle-question/vehicle-question.vue';
|
||||||
import { useMainStore } from '@/store';
|
import { useMainStore } from '@/store';
|
||||||
|
|
||||||
// Supporting files
|
// Supporting files
|
||||||
|
|
@ -195,16 +195,16 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async updateYearValues() {
|
async updateYearValues() {
|
||||||
return await useMainStore().getVehicleYears();
|
return useMainStore().getVehicleYears();
|
||||||
},
|
},
|
||||||
async updateMakeValues() {
|
async updateMakeValues() {
|
||||||
return await this.mainStore.getVehicleMakes();
|
return this.mainStore.getVehicleMakes();
|
||||||
},
|
},
|
||||||
async updateModelValues() {
|
async updateModelValues() {
|
||||||
return await this.mainStore.getVehicleModels();
|
return this.mainStore.getVehicleModels();
|
||||||
},
|
},
|
||||||
async updateStyleValues() {
|
async updateStyleValues() {
|
||||||
return await this.mainStore.getVehicleStyles();
|
return this.mainStore.getVehicleStyles();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import textLink from '@/ux-components/text-link/text-link';
|
import textLink from '@/ux-components/text-link/text-link.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'vin-location-information',
|
name: 'vin-location-information',
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
aria-label="perfect-match-alert" />
|
aria-label="perfect-match-alert" />
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import alert from '@/ux-components/alert/alert';
|
import alert from '@/ux-components/alert/alert.vue';
|
||||||
import { getDamageString } from '@/helpers/damage-helper';
|
import { getDamageString } from '@/helpers/damage-helper';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { getDamageString } from '@/helpers/damage-helper';
|
import { getDamageString } from '@/helpers/damage-helper';
|
||||||
|
|
||||||
import alert from '@/ux-components/alert/alert';
|
import alert from '@/ux-components/alert/alert.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'two-identical-ymm-vehicle-alert',
|
name: 'two-identical-ymm-vehicle-alert',
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
aria-label="vehicle-not-found-alert" />
|
aria-label="vehicle-not-found-alert" />
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import alert from '@/ux-components/alert/alert';
|
import alert from '@/ux-components/alert/alert.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'vehicle-not-found-alert',
|
name: 'vehicle-not-found-alert',
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { getDamageString } from '@/helpers/damage-helper';
|
import { getDamageString } from '@/helpers/damage-helper';
|
||||||
|
|
||||||
import alert from '@/ux-components/alert/alert';
|
import alert from '@/ux-components/alert/alert.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'vehicle-not-matched-alert',
|
name: 'vehicle-not-matched-alert',
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import vehicleLookupAlertTypes from '@/constants/vehicle-lookup-alert-types';
|
||||||
import { RouterLinkStub } from '@vue/test-utils';
|
import { RouterLinkStub } from '@vue/test-utils';
|
||||||
import { render } from '@testing-library/vue';
|
import { render } from '@testing-library/vue';
|
||||||
import '@testing-library/jest-dom';
|
import '@testing-library/jest-dom';
|
||||||
import VinLookupAlertsComponent from '@/layouts/vin-lookup/vin-lookup-alerts/vin-lookup-alerts';
|
import VinLookupAlertsComponent from '@/layouts/vin-lookup/vin-lookup-alerts/vin-lookup-alerts.vue';
|
||||||
|
|
||||||
jest.mock('@/helpers/damage-helper');
|
jest.mock('@/helpers/damage-helper');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,11 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import vehicleLookupAlertTypes from '@/constants/vehicle-lookup-alert-types';
|
import vehicleLookupAlertTypes from '@/constants/vehicle-lookup-alert-types';
|
||||||
import vehicleNotFoundAlert from '@/layouts/vin-lookup/vin-lookup-alerts/vehicle-not-found-alert/vehicle-not-found-alert';
|
import vehicleNotFoundAlert from '@/layouts/vin-lookup/vin-lookup-alerts/vehicle-not-found-alert/vehicle-not-found-alert.vue';
|
||||||
import vehicleNotMatchedAlert from '@/layouts/vin-lookup/vin-lookup-alerts/vehicle-not-matched-alert/vehicle-not-matched-alert';
|
import vehicleNotMatchedAlert from '@/layouts/vin-lookup/vin-lookup-alerts/vehicle-not-matched-alert/vehicle-not-matched-alert.vue';
|
||||||
import twoIdenticalYMMVehicleAlert from
|
import twoIdenticalYMMVehicleAlert from
|
||||||
'@/layouts/vin-lookup/vin-lookup-alerts/two-identical-ymm-vehicle-alert/two-identical-ymm-vehicle-alert';
|
'@/layouts/vin-lookup/vin-lookup-alerts/two-identical-ymm-vehicle-alert/two-identical-ymm-vehicle-alert.vue';
|
||||||
import perfectMatchAlert from '@/layouts/vin-lookup/vin-lookup-alerts//perfect-match-alert/perfect-match-alert';
|
import perfectMatchAlert from '@/layouts/vin-lookup/vin-lookup-alerts//perfect-match-alert/perfect-match-alert.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'vin-lookup-alerts',
|
name: 'vin-lookup-alerts',
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ 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-constants/router-params';
|
import routerParams from '@/router/router-constants/router-params';
|
||||||
import { useMainStore } from '@/store';
|
import { useMainStore } from '@/store';
|
||||||
import VinLookupComponent from '@/layouts/vin-lookup/vin-lookup.vue';
|
import VinLookupComponent from '@/layouts/vin-lookup/vin-lookup.vue';
|
||||||
|
|
@ -278,6 +278,7 @@ describe('vin-lookup.vue', () => {
|
||||||
expect(mockRouter.navigate).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK, mockRoute);
|
expect(mockRouter.navigate).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK, mockRoute);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
test('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 () => {
|
test('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 () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
mountOptions.global.stubs.vinQuestion = false;
|
mountOptions.global.stubs.vinQuestion = false;
|
||||||
|
|
@ -305,16 +306,15 @@ describe('vin-lookup.vue', () => {
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
||||||
expect(mockRouter.navigate).toHaveBeenCalledWith(
|
expect(mockRouter.navigate).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS,
|
||||||
navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS,
|
|
||||||
mockRoute,
|
mockRoute,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true }
|
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true });
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Succesful navigateForward', () => {
|
describe('Succesful navigateForward', () => {
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
test('Vehicle with Part Questions. Click "Continue", execute navigate with navigationScenario.CLICKED_FORWARD_WITH_PART_QUESTIONS', async () => {
|
test('Vehicle with Part Questions. Click "Continue", execute navigate with navigationScenario.CLICKED_FORWARD_WITH_PART_QUESTIONS', async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
mountOptions.global.stubs.vinQuestion = false;
|
mountOptions.global.stubs.vinQuestion = false;
|
||||||
|
|
@ -336,16 +336,15 @@ describe('vin-lookup.vue', () => {
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
||||||
expect(mockRouter.navigate)
|
expect(mockRouter.navigate)
|
||||||
.toHaveBeenCalledWith(
|
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS,
|
||||||
navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS,
|
|
||||||
mockRoute,
|
mockRoute,
|
||||||
{},
|
{},
|
||||||
{},
|
{},
|
||||||
{ partsOrQuestions: getPartsOrQuestions.mockResponse.data.partsOrQuestions }
|
{ partsOrQuestions: getPartsOrQuestions.mockResponse.data.partsOrQuestions });
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
test('Vehicle with Multiple Parts. Click "Continue", execute navigate with navigationScenario.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE', async () => {
|
test('Vehicle with Multiple Parts. Click "Continue", execute navigate with navigationScenario.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE', async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
mountOptions.global.stubs.vinQuestion = false;
|
mountOptions.global.stubs.vinQuestion = false;
|
||||||
|
|
@ -367,16 +366,15 @@ describe('vin-lookup.vue', () => {
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
||||||
expect(mockRouter.navigate)
|
expect(mockRouter.navigate)
|
||||||
.toHaveBeenCalledWith(
|
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE,
|
||||||
navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE,
|
|
||||||
mockRoute,
|
mockRoute,
|
||||||
{},
|
{},
|
||||||
{},
|
{},
|
||||||
{ partsOrQuestions: getPartsOrQuestions.mockResponse.data.partsOrQuestions }
|
{ partsOrQuestions: getPartsOrQuestions.mockResponse.data.partsOrQuestions });
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
test('Vehicle with Molding Questions. Click "Continue", execute navigate with navigationScenario.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS', async () => {
|
test('Vehicle with Molding Questions. Click "Continue", execute navigate with navigationScenario.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS', async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
mountOptions.global.stubs.vinQuestion = false;
|
mountOptions.global.stubs.vinQuestion = false;
|
||||||
|
|
@ -398,16 +396,15 @@ describe('vin-lookup.vue', () => {
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
||||||
expect(mockRouter.navigate)
|
expect(mockRouter.navigate)
|
||||||
.toHaveBeenCalledWith(
|
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS,
|
||||||
navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS,
|
|
||||||
mockRoute,
|
mockRoute,
|
||||||
{},
|
{},
|
||||||
{},
|
{},
|
||||||
{ partsOrQuestions: getPartsOrQuestions.mockResponse.data.partsOrQuestions }
|
{ partsOrQuestions: getPartsOrQuestions.mockResponse.data.partsOrQuestions });
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
test('Vehicle with Capability Questions. Click "Continue", execute navigate with navigationScenario.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS', async () => {
|
test('Vehicle with Capability Questions. Click "Continue", execute navigate with navigationScenario.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS', async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
const store = useMainStore();
|
const store = useMainStore();
|
||||||
|
|
@ -432,16 +429,15 @@ describe('vin-lookup.vue', () => {
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
||||||
expect(mockRouter.navigate)
|
expect(mockRouter.navigate)
|
||||||
.toHaveBeenCalledWith(
|
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS,
|
||||||
navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS,
|
|
||||||
mockRoute,
|
mockRoute,
|
||||||
{},
|
{},
|
||||||
{},
|
{},
|
||||||
{ partsOrQuestions: getPartsOrQuestions.mockResponse.data.partsOrQuestions }
|
{ partsOrQuestions: getPartsOrQuestions.mockResponse.data.partsOrQuestions });
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
test('Vehicle no additional Parts or Questions. Click "Continue", execute navigate with navigationScenario.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS', async () => {
|
test('Vehicle no additional Parts or Questions. Click "Continue", execute navigate with navigationScenario.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS', async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
mountOptions.global.stubs.vinQuestion = false;
|
mountOptions.global.stubs.vinQuestion = false;
|
||||||
|
|
@ -464,15 +460,13 @@ describe('vin-lookup.vue', () => {
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
||||||
expect(mockRouter.navigate)
|
expect(mockRouter.navigate)
|
||||||
.toHaveBeenCalledWith(
|
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
|
||||||
navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
|
mockRoute);
|
||||||
mockRoute
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Selected vehicle VIN do not match vehicles (CarIDs) in our system then navigate forward to bailout page.', async () => {
|
test('Selected vehicle VIN do not match vehicles (CarIDs) in our system then navigate forward to bailout page.', async () => {
|
||||||
//Arrange
|
// Arrange
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
lookupVehicleByVin.mockResponse.data.error = true;
|
lookupVehicleByVin.mockResponse.data.error = true;
|
||||||
|
|
||||||
|
|
@ -492,10 +486,8 @@ describe('vin-lookup.vue', () => {
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
||||||
expect(mockRouter.navigate).toHaveBeenCalledWith(
|
expect(mockRouter.navigate).toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_BAILOUT,
|
||||||
navigationScenarios.CLICKED_FORWARD_WITH_BAILOUT,
|
mockRoute);
|
||||||
mockRoute
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
ref="theForm"
|
ref="theForm"
|
||||||
v-slot="{ meta }"
|
v-slot="{ meta }"
|
||||||
@submit="onSubmit"
|
@submit="onSubmit"
|
||||||
@invalid-submit="onInvalidSubmit">
|
@invalidSubmit="onInvalidSubmit">
|
||||||
<div class="page-container-grouped-styles">
|
<div class="page-container-grouped-styles">
|
||||||
<div class="fade-on-route-transition position-relative">
|
<div class="fade-on-route-transition position-relative">
|
||||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||||
|
|
@ -130,6 +130,7 @@ export default {
|
||||||
return (vinYmmFound.toLowerCase() === vinYmmExpected.toLowerCase());
|
return (vinYmmFound.toLowerCase() === vinYmmExpected.toLowerCase());
|
||||||
},
|
},
|
||||||
vinMask() {
|
vinMask() {
|
||||||
|
// TODO: Side effects in computed.
|
||||||
if (this.vinPopulatedOnPageLoad) {
|
if (this.vinPopulatedOnPageLoad) {
|
||||||
// TODO: Modify to remove side effects in computed
|
// TODO: Modify to remove side effects in computed
|
||||||
this.activeVehicleLookupAlertType = vehicleLookupAlertTypes.PERFECT_MATCH;
|
this.activeVehicleLookupAlertType = vehicleLookupAlertTypes.PERFECT_MATCH;
|
||||||
|
|
@ -241,6 +242,8 @@ export default {
|
||||||
|
|
||||||
// Comes from vehicleQuestionsMixin.navigateForward()
|
// Comes from vehicleQuestionsMixin.navigateForward()
|
||||||
await this.navigateForward(partsOrQuestionsResponse.data.partsOrQuestions, this);
|
await this.navigateForward(partsOrQuestionsResponse.data.partsOrQuestions, this);
|
||||||
|
|
||||||
|
return null;
|
||||||
},
|
},
|
||||||
async getPartsOrQuestions() {
|
async getPartsOrQuestions() {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ 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.vue';
|
||||||
|
|
||||||
defineRule('vin-required', required(errorMessages.VIN_REQUIRED));
|
defineRule('vin-required', required(errorMessages.VIN_REQUIRED));
|
||||||
defineRule('vin-format', regex(/^[a-hA-Hj-nJ-NpPr-zR-Z0-9]{17}$/, errorMessages.VIN_FORMAT));
|
defineRule('vin-format', regex(/^[a-hA-Hj-nJ-NpPr-zR-Z0-9]{17}$/, errorMessages.VIN_FORMAT));
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import baseMixin from '@/mixins/base-mixin.js';
|
||||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
import applicationConfig from '@/constants/application-config';
|
import applicationConfig from '@/constants/application-config';
|
||||||
import { useMainStore } from '@/store';
|
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.
|
// Mock our module for promises.
|
||||||
jest.mock('@/helpers/layout-helper.js', () => ({
|
jest.mock('@/helpers/layout-helper.js', () => ({
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,15 @@
|
||||||
<template>
|
<template>
|
||||||
<Form ref="theForm" v-slot="{ meta }" @submit="onSubmit" @invalid-submit="onInvalidSubmit">
|
<Form
|
||||||
|
ref="theForm"
|
||||||
|
v-slot="{ meta }"
|
||||||
|
@submit="onSubmit"
|
||||||
|
@invalidSubmit="onInvalidSubmit">
|
||||||
<div class="page-container-grouped-styles welcome">
|
<div class="page-container-grouped-styles welcome">
|
||||||
<div class="fade-on-route-transition position-relative">
|
<div class="fade-on-route-transition position-relative">
|
||||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||||
<siteSubHeader cmsWidgetName="SiteSubHeaderWidget" class="mt-4" />
|
<siteSubHeader
|
||||||
|
cmsWidgetName="SiteSubHeaderWidget"
|
||||||
|
class="mt-4" />
|
||||||
<div class="container-fluid px-5">
|
<div class="container-fluid px-5">
|
||||||
<div class="row mt-5">
|
<div class="row mt-5">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
|
@ -18,7 +24,9 @@
|
||||||
:validationRules="rules.policyNumber" />
|
:validationRules="rules.policyNumber" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="isCoverageEnabled" class="row mt-4">
|
<div
|
||||||
|
v-if="isCoverageEnabled"
|
||||||
|
class="row mt-4">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<textboxQuestion
|
<textboxQuestion
|
||||||
ref="policyZip"
|
ref="policyZip"
|
||||||
|
|
@ -138,13 +146,15 @@
|
||||||
isSmallQuestionLabelText
|
isSmallQuestionLabelText
|
||||||
disableAutoFill />
|
disableAutoFill />
|
||||||
</div>
|
</div>
|
||||||
<div id="welcomeFooter" class="row position-sticky top-100">
|
<div
|
||||||
|
id="welcomeFooter"
|
||||||
|
class="row position-sticky top-100">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<siteFooter
|
<siteFooter
|
||||||
class="mt-3"
|
class="mt-3"
|
||||||
cmsWidgetName="SiteFooterWidget"
|
cmsWidgetName="SiteFooterWidget"
|
||||||
:isForwardActionDisabled="!meta.valid"
|
:isForwardActionDisabled="!meta.valid"
|
||||||
@back-clicked="backButtonAction"
|
@backClicked="backButtonAction"
|
||||||
@ForwardClicked="forwardButtonAction" />
|
@ForwardClicked="forwardButtonAction" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -156,13 +166,13 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Components
|
// Components
|
||||||
import siteHeader from '@/iss-components/site-header/site-header';
|
import siteHeader from '@/iss-components/site-header/site-header.vue';
|
||||||
import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header';
|
import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header.vue';
|
||||||
import siteFooter from '@/iss-components/site-footer/site-footer';
|
import siteFooter from '@/iss-components/site-footer/site-footer.vue';
|
||||||
import textboxQuestion from '@/digital-components/textbox-question/textbox-question';
|
import textboxQuestion from '@/digital-components/textbox-question/textbox-question.vue';
|
||||||
import buttonQuestion from '@/digital-components/button-question/button-question';
|
import buttonQuestion from '@/digital-components/button-question/button-question.vue';
|
||||||
import dropdownQuestion from '@/digital-components/dropdown-question/dropdown-question';
|
import dropdownQuestion from '@/digital-components/dropdown-question/dropdown-question.vue';
|
||||||
import textBlock from '@/digital-components/text-block/text-block';
|
import textBlock from '@/digital-components/text-block/text-block.vue';
|
||||||
|
|
||||||
// Supporting files
|
// Supporting files
|
||||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||||
|
|
@ -182,10 +192,8 @@ defineRule('loss-state-required', required(errorMessages.LOSS_STATE_REQUIRED));
|
||||||
defineRule('loss-city-required', required(errorMessages.LOSS_CITY_REQUIRED));
|
defineRule('loss-city-required', required(errorMessages.LOSS_CITY_REQUIRED));
|
||||||
defineRule('damage-option-required', required(errorMessages.DAMAGE_OPTION_REQUIRED));
|
defineRule('damage-option-required', required(errorMessages.DAMAGE_OPTION_REQUIRED));
|
||||||
defineRule('policy-zip-required', required(errorMessages.POLICY_ZIP_REQUIRED));
|
defineRule('policy-zip-required', required(errorMessages.POLICY_ZIP_REQUIRED));
|
||||||
defineRule(
|
defineRule('policy-zip-format',
|
||||||
'policy-zip-format',
|
regex(/(^\d{5}$)|(^\d{5}-\d{4}$)/, errorMessages.POLICY_ZIP_FORMAT));
|
||||||
regex(/(^\d{5}$)|(^\d{5}-\d{4}$)/, errorMessages.POLICY_ZIP_FORMAT)
|
|
||||||
);
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'welcome-page',
|
name: 'welcome-page',
|
||||||
|
|
@ -249,6 +257,7 @@ export default {
|
||||||
const damageCauseAnswers = this.getCmsContent('DamageCauseQuestion', 'Answers');
|
const damageCauseAnswers = this.getCmsContent('DamageCauseQuestion', 'Answers');
|
||||||
const damageCauseAnswersObj = {};
|
const damageCauseAnswersObj = {};
|
||||||
if (damageCauseAnswers) {
|
if (damageCauseAnswers) {
|
||||||
|
// eslint-disable-next-line no-restricted-syntax
|
||||||
for (const answer of Object.values(damageCauseAnswers)) {
|
for (const answer of Object.values(damageCauseAnswers)) {
|
||||||
if (answer?.Name) {
|
if (answer?.Name) {
|
||||||
damageCauseAnswersObj[answer.Name] = answer.Name;
|
damageCauseAnswersObj[answer.Name] = answer.Name;
|
||||||
|
|
@ -334,27 +343,21 @@ export default {
|
||||||
if (policy) {
|
if (policy) {
|
||||||
if (this.vehiclesFound) {
|
if (this.vehiclesFound) {
|
||||||
// if policy lookup is successful and vehicles are found, navigate to policy-vehicles page
|
// if policy lookup is successful and vehicles are found, navigate to policy-vehicles page
|
||||||
this.$router.navigate(
|
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
|
||||||
this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
|
|
||||||
this.$route,
|
this.$route,
|
||||||
{},
|
{},
|
||||||
{},
|
{},
|
||||||
this.vehiclesFound
|
this.vehiclesFound);
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
// if policy lookup is successful, but no vehicles are associated with the policy
|
// if policy lookup is successful, but no vehicles are associated with the policy
|
||||||
// navigate to vehicle-selection page (manual entry)
|
// navigate to vehicle-selection page (manual entry)
|
||||||
this.$router.navigate(
|
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
|
||||||
this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
|
this.$route);
|
||||||
this.$route
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if policy lookup is unsuccessful, navigate to policy-holder-details page
|
// if policy lookup is unsuccessful, navigate to policy-holder-details page
|
||||||
this.$router.navigate(
|
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
|
||||||
this.navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
|
this.$route);
|
||||||
this.$route
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,19 @@ import {
|
||||||
import cookieNames from '@/constants/cookie-names';
|
import cookieNames from '@/constants/cookie-names';
|
||||||
import { useMainStore } from '@/store';
|
import { useMainStore } from '@/store';
|
||||||
|
|
||||||
|
function pushToDataLayerIfDefined(data) {
|
||||||
|
if (window.dataLayer !== undefined) {
|
||||||
|
window.dataLayer.push(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getValueToLog(value, valueToLogType) {
|
||||||
|
if (valueToLogType != null && valueToLogType === ValueToLogTypes.LAST_5) {
|
||||||
|
return value.slice(-5);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
getPageNameByQueryString() {
|
getPageNameByQueryString() {
|
||||||
|
|
@ -102,8 +115,7 @@ export default {
|
||||||
let googleDimensionIndex = 99;
|
let googleDimensionIndex = 99;
|
||||||
|
|
||||||
if (exp.settings[experimentSettings.GOOGLE_CUSTOM_DIMENSION_INDEX] !== undefined) {
|
if (exp.settings[experimentSettings.GOOGLE_CUSTOM_DIMENSION_INDEX] !== undefined) {
|
||||||
googleDimensionIndex
|
googleDimensionIndex = exp.settings[experimentSettings.GOOGLE_CUSTOM_DIMENSION_INDEX];
|
||||||
= exp.settings[experimentSettings.GOOGLE_CUSTOM_DIMENSION_INDEX];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create object with dimension index and value.
|
// Create object with dimension index and value.
|
||||||
|
|
@ -184,16 +196,3 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function pushToDataLayerIfDefined(data) {
|
|
||||||
if (window.dataLayer !== undefined) {
|
|
||||||
window.dataLayer.push(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getValueToLog(value, valueToLogType) {
|
|
||||||
if (valueToLogType != null && valueToLogType === ValueToLogTypes.LAST_5) {
|
|
||||||
return value.slice(-5);
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import analyticsMixin from '@/mixins/analytics-mixin';
|
import analyticsMixin from '@/mixins/analytics-mixin';
|
||||||
import { setupMocksForJsFiles, setupCookies } from '@/helpers/unit-test-helper.js';
|
import { setupCookies } from '@/helpers/unit-test-helper.js';
|
||||||
import {
|
import {
|
||||||
analyticsPageEvents,
|
analyticsPageEvents,
|
||||||
GaCategories,
|
GaCategories,
|
||||||
|
|
@ -74,6 +74,7 @@ describe('analyticsMixin.js', () => {
|
||||||
expect(expectedDataLayer).toEqual(expect.arrayContaining(window.dataLayer));
|
expect(expectedDataLayer).toEqual(expect.arrayContaining(window.dataLayer));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
test('pushEventToGA, should call dataLayer push and ValueToLogTypes.LAST_5 logs only the last 3 characters for a 3 character string', () => {
|
test('pushEventToGA, should call dataLayer push and ValueToLogTypes.LAST_5 logs only the last 3 characters for a 3 character string', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
window.dataLayer = [];
|
window.dataLayer = [];
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,17 @@
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
/** DO NOT REMOVE;
|
/**
|
||||||
* Needed to prevent default form submit behavior.
|
* DO NOT REMOVE;
|
||||||
* Cannot use .prevent modifier for vee-validate Form.
|
* Needed to prevent default form submit behavior.
|
||||||
*/
|
* Cannot use .prevent modifier for vee-validate Form.
|
||||||
|
*/
|
||||||
},
|
},
|
||||||
onInvalidSubmit({ errors }) {
|
onInvalidSubmit({ errors }) {
|
||||||
/**
|
/**
|
||||||
* Identify the first error field and put focus on it
|
* Identify the first error field and put focus on it
|
||||||
* get error names array
|
* get error names array
|
||||||
*/
|
*/
|
||||||
const errorNames = errors ? Object.keys(errors) : [];
|
const errorNames = errors ? Object.keys(errors) : [];
|
||||||
const firstErrorEl = errorNames[0];
|
const firstErrorEl = errorNames[0];
|
||||||
if (firstErrorEl) {
|
if (firstErrorEl) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
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';
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,40 @@ import { shallowMount } from '@vue/test-utils';
|
||||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
import { useMainStore } from '@/store';
|
import { useMainStore } from '@/store';
|
||||||
|
|
||||||
|
/** @ignore */
|
||||||
|
function setupMocks({ experimentSettings }) {
|
||||||
|
const store = useMainStore();
|
||||||
|
const mocks = getMountOptions({});
|
||||||
|
|
||||||
|
const testExperimentSettings = {
|
||||||
|
Setting1: 'Value1',
|
||||||
|
Setting2: 'Value2',
|
||||||
|
Setting3: 'Value3',
|
||||||
|
Setting4: 'Value1',
|
||||||
|
Setting5: 'Value2',
|
||||||
|
Setting6: 'Value3'
|
||||||
|
};
|
||||||
|
|
||||||
|
const mockExperimentData = [
|
||||||
|
{
|
||||||
|
settings: experimentSettings ?? testExperimentSettings,
|
||||||
|
variationName: 'test',
|
||||||
|
universeName: 'testUniverse'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
store.applicationUser.experiments = mockExperimentData;
|
||||||
|
|
||||||
|
const mockComponent = {
|
||||||
|
template: '<div></div>',
|
||||||
|
mixins: [experimentMixin]
|
||||||
|
};
|
||||||
|
|
||||||
|
const wrapper = shallowMount(mockComponent, mocks);
|
||||||
|
|
||||||
|
return { wrapper };
|
||||||
|
}
|
||||||
|
|
||||||
describe('experiment-mixin', () => {
|
describe('experiment-mixin', () => {
|
||||||
describe('hasSettingEqualTo', () => {
|
describe('hasSettingEqualTo', () => {
|
||||||
test('setting exists and value matches => return true', () => {
|
test('setting exists and value matches => return true', () => {
|
||||||
|
|
@ -120,36 +154,3 @@ describe('experiment-mixin', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function setupMocks({ experimentSettings }) {
|
|
||||||
const store = useMainStore();
|
|
||||||
const mocks = getMountOptions({});
|
|
||||||
|
|
||||||
const testExperimentSettings = {
|
|
||||||
Setting1: 'Value1',
|
|
||||||
Setting2: 'Value2',
|
|
||||||
Setting3: 'Value3',
|
|
||||||
Setting4: 'Value1',
|
|
||||||
Setting5: 'Value2',
|
|
||||||
Setting6: 'Value3'
|
|
||||||
};
|
|
||||||
|
|
||||||
const mockExperimentData = [
|
|
||||||
{
|
|
||||||
settings: experimentSettings ?? testExperimentSettings,
|
|
||||||
variationName: 'test',
|
|
||||||
universeName: 'testUniverse'
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
store.applicationUser.experiments = mockExperimentData;
|
|
||||||
|
|
||||||
const mockComponent = {
|
|
||||||
template: '<div></div>',
|
|
||||||
mixins: [experimentMixin]
|
|
||||||
};
|
|
||||||
|
|
||||||
const wrapper = shallowMount(mockComponent, mocks);
|
|
||||||
|
|
||||||
return { wrapper };
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import issPageValues from '@/router/router-constants/issPage-values';
|
import issPageValues from '@/router/router-constants/issPage-values';
|
||||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
|
import navigationScenarios from '@/router/router-constants/navigation-scenarios';
|
||||||
import { useMainStore } from '@/store';
|
import { useMainStore } from '@/store';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -106,8 +106,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark this question as answered (question-chain will read this)
|
// mark this question as answered (question-chain will read this)
|
||||||
glass.questions[answeredQuestion.questionNum - 1].answerSelected
|
glass.questions[answeredQuestion.questionNum - 1].answerSelected = answerString;
|
||||||
= answerString;
|
|
||||||
// mark this question as suppressed if needed (question-chain uses this)
|
// mark this question as suppressed if needed (question-chain uses this)
|
||||||
if (answeredQuestion.suppressThisQuestion) {
|
if (answeredQuestion.suppressThisQuestion) {
|
||||||
glass.questions[
|
glass.questions[
|
||||||
|
|
@ -351,8 +350,7 @@ export default {
|
||||||
const currentPage = self.$route.query.issPage;
|
const currentPage = self.$route.query.issPage;
|
||||||
|
|
||||||
const hasPartQuestions = this.hasPartQuestions(partsOrQuestions);
|
const hasPartQuestions = this.hasPartQuestions(partsOrQuestions);
|
||||||
const hasGlassLocationWithMultipleParts
|
const hasGlassLocationWithMultipleParts = this.hasGlassLocationWithMultipleParts(partsOrQuestions);
|
||||||
= this.hasGlassLocationWithMultipleParts(partsOrQuestions);
|
|
||||||
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
|
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
|
||||||
const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions);
|
const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions);
|
||||||
|
|
||||||
|
|
@ -385,6 +383,7 @@ export default {
|
||||||
// go to capability-questions page and pass the partsData
|
// go to capability-questions page and pass the partsData
|
||||||
|
|
||||||
// mimic part-questions page data for consistency
|
// mimic part-questions page data for consistency
|
||||||
|
// eslint-disable-next-line no-restricted-syntax
|
||||||
for (const partOrQuestion of partsOrQuestions) {
|
for (const partOrQuestion of partsOrQuestions) {
|
||||||
if (this.hasCapabilityQuestions([partOrQuestion])) {
|
if (this.hasCapabilityQuestions([partOrQuestion])) {
|
||||||
const capabilityQuestionsForGlassLocation = (await useMainStore().getCapabilityQuestions(useMainStore().vehicle.carId, partOrQuestion.parts[0].partNumber)).data;
|
const capabilityQuestionsForGlassLocation = (await useMainStore().getCapabilityQuestions(useMainStore().vehicle.carId, partOrQuestion.parts[0].partNumber)).data;
|
||||||
|
|
@ -425,8 +424,7 @@ export default {
|
||||||
?? self.mainStore.pageData(issPageValues.PART_QUESTIONS)
|
?? self.mainStore.pageData(issPageValues.PART_QUESTIONS)
|
||||||
)?.partsOrQuestions;
|
)?.partsOrQuestions;
|
||||||
const hasPartQuestions = this.hasPartQuestions(partsOrQuestions);
|
const hasPartQuestions = this.hasPartQuestions(partsOrQuestions);
|
||||||
const hasGlassLocationWithMultipleParts
|
const hasGlassLocationWithMultipleParts = this.hasGlassLocationWithMultipleParts(partsOrQuestions);
|
||||||
= this.hasGlassLocationWithMultipleParts(partsOrQuestions);
|
|
||||||
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
|
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
|
||||||
const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions);
|
const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions);
|
||||||
let backNavigationScenario = '';
|
let backNavigationScenario = '';
|
||||||
|
|
@ -453,8 +451,7 @@ export default {
|
||||||
hasGlassLocationWithMultipleParts
|
hasGlassLocationWithMultipleParts
|
||||||
&& this.currentPageComesAfterPage(currentPage, issPageValues.VEHICLE_PARTS)
|
&& this.currentPageComesAfterPage(currentPage, issPageValues.VEHICLE_PARTS)
|
||||||
) {
|
) {
|
||||||
backNavigationScenario
|
backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE;
|
||||||
= navigationScenarios.CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE;
|
|
||||||
} else if (
|
} else if (
|
||||||
hasPartQuestions
|
hasPartQuestions
|
||||||
&& this.currentPageComesAfterPage(currentPage, issPageValues.PART_QUESTIONS)
|
&& this.currentPageComesAfterPage(currentPage, issPageValues.PART_QUESTIONS)
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,53 @@ import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin';
|
||||||
import { shallowMount } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
import { setupMocksForJsFiles, getMountOptions } from '@/helpers/unit-test-helper.js';
|
import { setupMocksForJsFiles, getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
import issPageValues from '@/router/router-constants/issPage-values';
|
import issPageValues from '@/router/router-constants/issPage-values';
|
||||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
|
import navigationScenarios from '@/router/router-constants/navigation-scenarios';
|
||||||
import { useMainStore } from '@/store';
|
import { useMainStore } from '@/store';
|
||||||
|
|
||||||
|
/** @ignore */
|
||||||
|
function setupMocks({ issPage = issPageValues.VIN_LOOKUP }) {
|
||||||
|
const baseMixin = setupMocksForJsFiles({
|
||||||
|
actionList: [
|
||||||
|
{
|
||||||
|
actionName: 'getCapabilityQuestions',
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
answers: [
|
||||||
|
{
|
||||||
|
answerResult1: 'testing'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const mocks = getMountOptions({
|
||||||
|
router: {
|
||||||
|
navigate: jest.fn()
|
||||||
|
},
|
||||||
|
route: {
|
||||||
|
query: {
|
||||||
|
issPage
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const mockVehicleQuestionComponent = {
|
||||||
|
template: '<div />',
|
||||||
|
mixins: [vehicleQuestionsMixin, baseMixin.baseMixin]
|
||||||
|
};
|
||||||
|
|
||||||
|
const store = useMainStore();
|
||||||
|
const actionResult = [];
|
||||||
|
store.getCapabilityQuestions.mockImplementation(() => Promise.resolve({ data: actionResult }));
|
||||||
|
|
||||||
|
const wrapper = shallowMount(mockVehicleQuestionComponent, mocks);
|
||||||
|
|
||||||
|
return { wrapper };
|
||||||
|
}
|
||||||
|
|
||||||
describe('vehicle-questions-mixin', () => {
|
describe('vehicle-questions-mixin', () => {
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
jest.clearAllMocks();
|
jest.clearAllMocks();
|
||||||
|
|
@ -2082,46 +2126,3 @@ describe('vehicle-questions-mixin', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function setupMocks({ issPage = issPageValues.VIN_LOOKUP }) {
|
|
||||||
const baseMixin = setupMocksForJsFiles({
|
|
||||||
actionList: [
|
|
||||||
{
|
|
||||||
actionName: 'getCapabilityQuestions',
|
|
||||||
data: [
|
|
||||||
{
|
|
||||||
answers: [
|
|
||||||
{
|
|
||||||
answerResult1: 'testing'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
const mocks = getMountOptions({
|
|
||||||
router: {
|
|
||||||
navigate: jest.fn()
|
|
||||||
},
|
|
||||||
route: {
|
|
||||||
query: {
|
|
||||||
issPage
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const mockVehicleQuestionComponent = {
|
|
||||||
template: '<div />',
|
|
||||||
mixins: [vehicleQuestionsMixin, baseMixin.baseMixin]
|
|
||||||
};
|
|
||||||
|
|
||||||
const store = useMainStore();
|
|
||||||
const actionResult = [];
|
|
||||||
store.getCapabilityQuestions.mockImplementation(() => Promise.resolve({ data: actionResult }));
|
|
||||||
|
|
||||||
const wrapper = shallowMount(mockVehicleQuestionComponent, mocks);
|
|
||||||
|
|
||||||
return { wrapper };
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin';
|
import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin';
|
||||||
import { useMainStore } from '@/store';
|
import { useMainStore } from '@/store';
|
||||||
|
|
||||||
|
/** @ignore */
|
||||||
function setupMocks() {
|
function setupMocks() {
|
||||||
const mocks = getMountOptions({
|
const mocks = getMountOptions({
|
||||||
router: {
|
router: {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
export function lazyLoadComponent(componentName) {
|
export default function lazyLoadComponent(componentName) {
|
||||||
return () => import(`@/layouts/${componentName}/${componentName}.vue`); // /src/layouts/folder/component.vue
|
return () => import(`@/layouts/${componentName}/${componentName}.vue`); // /src/layouts/folder/component.vue
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { createWebHistory, createRouter } from 'vue-router';
|
import { createWebHistory, createRouter } from 'vue-router';
|
||||||
import { lazyLoadComponent } from '@/router/dynamic-routing/component-loader';
|
import lazyLoadComponent from '@/router/dynamic-routing/component-loader';
|
||||||
import issPageValues from '@/router/router-constants/issPage-values';
|
import issPageValues from '@/router/router-constants/issPage-values';
|
||||||
import { routingTable } from '@/router/router-constants/routing-table';
|
import { routingTable } from '@/router/router-constants/routing-table';
|
||||||
import { useMainStore } from '@/store';
|
import { useMainStore } from '@/store';
|
||||||
|
|
@ -15,7 +15,7 @@ import { experimentTriggers } from '@/constants/experiments';
|
||||||
import applicationConfig from '@/constants/application-config';
|
import applicationConfig from '@/constants/application-config';
|
||||||
|
|
||||||
import analyticsMixin from '@/mixins/analytics-mixin';
|
import analyticsMixin from '@/mixins/analytics-mixin';
|
||||||
import { navigationScenarios } from './router-constants/navigation-scenarios';
|
import navigationScenarios from './router-constants/navigation-scenarios';
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
const navigationScenarios = {
|
const navigationScenarios = Object.freeze({
|
||||||
// General
|
// General
|
||||||
CLICKED_BACK: 'CLICKED_BACK',
|
CLICKED_BACK: 'CLICKED_BACK',
|
||||||
CLICKED_BACK_PREVIOUS: 'CLICKED_BACK_PREVIOUS',
|
CLICKED_BACK_PREVIOUS: 'CLICKED_BACK_PREVIOUS',
|
||||||
|
|
@ -64,6 +64,6 @@ const navigationScenarios = {
|
||||||
|
|
||||||
// Bailout
|
// Bailout
|
||||||
CLICKED_FORWARD_WITH_BAILOUT: 'CLICKED_FORWARD_WITH_BAILOUT'
|
CLICKED_FORWARD_WITH_BAILOUT: 'CLICKED_FORWARD_WITH_BAILOUT'
|
||||||
};
|
});
|
||||||
|
|
||||||
export { navigationScenarios };
|
export default navigationScenarios;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import issPageValues from '@/router/router-constants/issPage-values';
|
import issPageValues from '@/router/router-constants/issPage-values';
|
||||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
|
import navigationScenarios from '@/router/router-constants/navigation-scenarios';
|
||||||
|
|
||||||
// Get store from router/index.js instead of importing it here to get updated values
|
// Get store from router/index.js instead of importing it here to get updated values
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import router from '@/router/';
|
import router from '@/router/';
|
||||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
|
import navigationScenarios from '@/router/router-constants/navigation-scenarios';
|
||||||
import issPageValues from '@/router/router-constants/issPage-values';
|
import issPageValues from '@/router/router-constants/issPage-values';
|
||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue';
|
||||||
import { createPinia } from 'pinia';
|
import { createPinia } from 'pinia';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue