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 { 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 issPageValues from '@/router/router-constants/issPage-values';
|
||||
import cookieNames from '@/constants/cookie-names';
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { settleAllPromises } from '@/helpers/layout-helper.js';
|
|||
import { shallowMount } from '@vue/test-utils';
|
||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||
import { useMainStore } from '@/store';
|
||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
|
||||
import navigationScenarios from '@/router/router-constants/navigation-scenarios';
|
||||
|
||||
jest.mock('@/helpers/damage-helper', () => ({
|
||||
isGlassAvailableForCarId: jest.fn().mockImplementation(() => true),
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { shallowMount } from '@vue/test-utils';
|
|||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||
import { getRandomString, getRandomInt, getRandomBoolean } from '@/helpers/data-generation.js';
|
||||
import { createTestingPinia } from '@pinia/testing';
|
||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios.js';
|
||||
import navigationScenarios from '@/router/router-constants/navigation-scenarios.js';
|
||||
import { useMainStore } from '@/store/index.js';
|
||||
|
||||
describe('contactDetails.vue', () => {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import coverageStatement from '@/layouts/coverage-statement/coverage-statement.v
|
|||
import { mount } from '@vue/test-utils';
|
||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||
import { createTestingPinia } from '@pinia/testing';
|
||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios.js';
|
||||
import navigationScenarios from '@/router/router-constants/navigation-scenarios.js';
|
||||
import { getRandomString, getRandomInt } from '@/helpers/data-generation.js';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper.js';
|
||||
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 globalRules from '@/constants/global-rules.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 {
|
||||
name: 'coverage-statement',
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { settleAllPromises } from '@/helpers/layout-helper.js';
|
|||
import { shallowMount } from '@vue/test-utils';
|
||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||
import { useMainStore } from '@/store';
|
||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
|
||||
import navigationScenarios from '@/router/router-constants/navigation-scenarios';
|
||||
|
||||
jest.mock('@/helpers/damage-helper', () => ({
|
||||
isGlassAvailableForCarId: jest.fn().mockImplementation(() => true),
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { shallowMount } from '@vue/test-utils';
|
|||
import { settleAllPromises } from '@/helpers/layout-helper.js';
|
||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||
import { useMainStore } from '@/store';
|
||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
|
||||
import navigationScenarios from '@/router/router-constants/navigation-scenarios';
|
||||
|
||||
// Mock our module for promises.
|
||||
jest.mock('@/helpers/layout-helper.js', () => ({
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { shallowMount } from '@vue/test-utils';
|
|||
import { getMountOptions } from '@/helpers/unit-test-helper';
|
||||
import { useMainStore } from '@/store';
|
||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
|
||||
import navigationScenarios from '@/router/router-constants/navigation-scenarios';
|
||||
import baseMixin from '@/mixins/base-mixin';
|
||||
import { getRandomString, getRandomInt } from '@/helpers/data-generation';
|
||||
import endorsementOptions from '@/constants/endorsement-options';
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { settleAllPromises } from '@/helpers/layout-helper.js';
|
|||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||
import { useMainStore } from '@/store';
|
||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
|
||||
import navigationScenarios from '@/router/router-constants/navigation-scenarios';
|
||||
|
||||
// Mock our module for promises.
|
||||
jest.mock('@/helpers/layout-helper.js', () => ({
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
ref="theForm"
|
||||
v-slot="{ meta }"
|
||||
@submit="onSubmit"
|
||||
@invalid-submit="onInvalidSubmit">
|
||||
@invalidSubmit="onInvalidSubmit">
|
||||
<div class="page-container-grouped-styles">
|
||||
<div class="fade-on-route-transition position-relative">
|
||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
cmsWidgetName="SiteFooterWidget"
|
||||
:isForwardActionDisabled="!meta.valid"
|
||||
@ForwardClicked="forwardButtonAction"
|
||||
@back-clicked="backButtonAction" />
|
||||
@backClicked="backButtonAction" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -22,8 +22,8 @@
|
|||
</template>
|
||||
<script>
|
||||
// Components
|
||||
import siteHeader from '@/iss-components/site-header/site-header';
|
||||
import siteFooter from '@/iss-components/site-footer/site-footer';
|
||||
import siteHeader from '@/iss-components/site-header/site-header.vue';
|
||||
import siteFooter from '@/iss-components/site-footer/site-footer.vue';
|
||||
// Supporting files
|
||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper';
|
||||
|
|
@ -36,6 +36,7 @@ export default {
|
|||
components: {
|
||||
siteHeader,
|
||||
siteFooter,
|
||||
// eslint-disable-next-line vue/no-reserved-component-names
|
||||
Form
|
||||
},
|
||||
mixins: [BaseFormMixin],
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
ref="theForm"
|
||||
v-slot="{ meta }"
|
||||
@submit="onSubmit"
|
||||
@invalid-submit="onInvalidSubmit">
|
||||
@invalidSubmit="onInvalidSubmit">
|
||||
<div class="page-container-grouped-styles">
|
||||
<div class="fade-on-route-transition position-relative">
|
||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
cmsWidgetName="SiteFooterWidget"
|
||||
:isForwardActionDisabled="!meta.valid"
|
||||
@ForwardClicked="forwardButtonAction"
|
||||
@back-clicked="backButtonAction" />
|
||||
@backClicked="backButtonAction" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -22,8 +22,8 @@
|
|||
</template>
|
||||
<script>
|
||||
// Components
|
||||
import siteHeader from '@/iss-components/site-header/site-header';
|
||||
import siteFooter from '@/iss-components/site-footer/site-footer';
|
||||
import siteHeader from '@/iss-components/site-header/site-header.vue';
|
||||
import siteFooter from '@/iss-components/site-footer/site-footer.vue';
|
||||
// Supporting files
|
||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper';
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
ref="theForm"
|
||||
v-slot="{ meta }"
|
||||
@submit="onSubmit"
|
||||
@invalid-submit="onInvalidSubmit">
|
||||
@invalidSubmit="onInvalidSubmit">
|
||||
<div class="page-container-grouped-styles">
|
||||
<div class="fade-on-route-transition position-relative">
|
||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
cmsWidgetName="SiteFooterWidget"
|
||||
:isForwardActionDisabled="!meta.valid"
|
||||
@ForwardClicked="forwardButtonAction"
|
||||
@back-clicked="backButtonAction" />
|
||||
@backClicked="backButtonAction" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -22,8 +22,8 @@
|
|||
</template>
|
||||
<script>
|
||||
// Components
|
||||
import siteHeader from '@/iss-components/site-header/site-header';
|
||||
import siteFooter from '@/iss-components/site-footer/site-footer';
|
||||
import siteHeader from '@/iss-components/site-header/site-header.vue';
|
||||
import siteFooter from '@/iss-components/site-footer/site-footer.vue';
|
||||
|
||||
// Supporting files
|
||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||
|
|
@ -37,6 +37,7 @@ export default {
|
|||
components: {
|
||||
siteHeader,
|
||||
siteFooter,
|
||||
// eslint-disable-next-line vue/no-reserved-component-names
|
||||
Form
|
||||
},
|
||||
mixins: [BaseFormMixin],
|
||||
|
|
|
|||
|
|
@ -1,7 +1,42 @@
|
|||
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';
|
||||
|
||||
/** @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', () => {
|
||||
test('Selected location option is emitted upon selection.', async () => {
|
||||
// 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>
|
||||
|
||||
<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 { required } from '@/helpers/validation-rules';
|
||||
import errorMessages from '@/constants/error-messages';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,52 @@
|
|||
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';
|
||||
|
||||
/** @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', () => {
|
||||
test('Selected damage option is emitted upon selection.', async () => {
|
||||
// Arrange
|
||||
|
|
@ -36,28 +81,29 @@ 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
|
||||
const { wrapper, cmsContent, replaceOptions } = setupMocks({
|
||||
modelValueProp: []
|
||||
});
|
||||
wrapper.setData({
|
||||
answersFromCms: [
|
||||
{
|
||||
Name: 'Stationary'
|
||||
},
|
||||
{
|
||||
Name: 'Slider'
|
||||
}
|
||||
]
|
||||
});
|
||||
wrapper.setData({ replaceOptions: ['Stationary'] });
|
||||
const { wrapper, cmsContent, replaceOptions } = setupMocks({
|
||||
modelValueProp: []
|
||||
});
|
||||
wrapper.setData({
|
||||
answersFromCms: [
|
||||
{
|
||||
Name: 'Stationary'
|
||||
},
|
||||
{
|
||||
Name: 'Slider'
|
||||
}
|
||||
]
|
||||
});
|
||||
wrapper.setData({ replaceOptions: ['Stationary'] });
|
||||
|
||||
// Act
|
||||
wrapper.vm.$options.methods.updateSelectedValues.call(wrapper.vm);
|
||||
// Act
|
||||
wrapper.vm.$options.methods.updateSelectedValues.call(wrapper.vm);
|
||||
|
||||
expect(wrapper.vm.selectedValues).toEqual([]);
|
||||
});
|
||||
expect(wrapper.vm.selectedValues).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('replace-options-question.vue', () => {
|
||||
|
|
@ -80,47 +126,3 @@ describe('replace-options-question.vue', () => {
|
|||
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>
|
||||
|
||||
<script>
|
||||
import buttonQuestion from '@/digital-components/button-question/button-question';
|
||||
import buttonQuestion from '@/digital-components/button-question/button-question.vue';
|
||||
|
||||
export default {
|
||||
name: 'replace-options-question',
|
||||
|
|
|
|||
|
|
@ -1,91 +1,9 @@
|
|||
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 replaceOptionsQuestion from '@/layouts/vehicle-damage/replace-options-question/replace-options-question';
|
||||
|
||||
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([]);
|
||||
});
|
||||
});
|
||||
import replaceOptionsQuestion from '@/layouts/vehicle-damage/replace-options-question/replace-options-question.vue';
|
||||
|
||||
/** @ignore */
|
||||
function setupMocks({
|
||||
modelValueProp = ['DriverSide'],
|
||||
groupName = 'sideDoorOptions',
|
||||
|
|
@ -133,3 +51,89 @@ function setupMocks({
|
|||
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>
|
||||
|
||||
<script>
|
||||
import buttonQuestion from '@/digital-components/button-question/button-question';
|
||||
import replaceOptionsQuestion from '@/layouts/vehicle-damage/replace-options-question/replace-options-question';
|
||||
import buttonQuestion from '@/digital-components/button-question/button-question.vue';
|
||||
import replaceOptionsQuestion from '@/layouts/vehicle-damage/replace-options-question/replace-options-question.vue';
|
||||
import { defineRule } from 'vee-validate';
|
||||
import { required } from '@/helpers/validation-rules';
|
||||
import errorMessages from '@/constants/error-messages';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* eslint-env jest */
|
||||
import { mount, flushPromises } from '@vue/test-utils';
|
||||
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 vehicleCategories from '@/constants/vehicle-categories';
|
||||
import VehicleDamageComponent from '@/layouts/vehicle-damage/vehicle-damage.vue';
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
ref="theForm"
|
||||
v-slot="{ meta }"
|
||||
@submit="onSubmit"
|
||||
@invalid-submit="onInvalidSubmit">
|
||||
@invalidSubmit="onInvalidSubmit">
|
||||
<div class="page-container-grouped-styles">
|
||||
<div class="fade-on-route-transition position-relative">
|
||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||
|
|
@ -72,15 +72,15 @@
|
|||
|
||||
<script>
|
||||
// Components
|
||||
import siteHeader from '@/iss-components/site-header/site-header';
|
||||
import siteFooter from '@/iss-components/site-footer/site-footer';
|
||||
import vehicleBanner from '@/iss-components/vehicle-banner/vehicle-banner';
|
||||
import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header';
|
||||
import sideDoorOptions from '@/layouts/vehicle-damage/side-door-options/side-door-options';
|
||||
import damageLocationQuestion from '@/layouts/vehicle-damage/damage-location-question/damage-location-question';
|
||||
import windshieldOptions from '@/layouts/vehicle-damage/windshield-options/windshield-options';
|
||||
import replaceOptionsQuestion from '@/layouts/vehicle-damage/replace-options-question/replace-options-question';
|
||||
import alert from '@/ux-components/alert/alert';
|
||||
import siteHeader from '@/iss-components/site-header/site-header.vue';
|
||||
import siteFooter from '@/iss-components/site-footer/site-footer.vue';
|
||||
import vehicleBanner from '@/iss-components/vehicle-banner/vehicle-banner.vue';
|
||||
import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header.vue';
|
||||
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.vue';
|
||||
import windshieldOptions from '@/layouts/vehicle-damage/windshield-options/windshield-options.vue';
|
||||
import replaceOptionsQuestion from '@/layouts/vehicle-damage/replace-options-question/replace-options-question.vue';
|
||||
import alert from '@/ux-components/alert/alert.vue';
|
||||
|
||||
// Supporting files
|
||||
import BaseFormMixin from '@/mixins/base-form-mixin.js';
|
||||
|
|
@ -285,8 +285,7 @@ export default {
|
|||
&& glass.glassName === damageLocationsSelected.SINGLE
|
||||
))
|
||||
) {
|
||||
windShieldOptions.selectedWindshieldDamageType
|
||||
= damageLocationsSelected.REPLACE;
|
||||
windShieldOptions.selectedWindshieldDamageType = damageLocationsSelected.REPLACE;
|
||||
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.SINGLE);
|
||||
}
|
||||
|
||||
|
|
@ -296,8 +295,7 @@ export default {
|
|||
&& glass.glassName === damageLocationsSelected.DRIVER
|
||||
))
|
||||
) {
|
||||
windShieldOptions.selectedWindshieldDamageType
|
||||
= damageLocationsSelected.REPLACE;
|
||||
windShieldOptions.selectedWindshieldDamageType = damageLocationsSelected.REPLACE;
|
||||
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.DRIVER);
|
||||
}
|
||||
|
||||
|
|
@ -307,8 +305,7 @@ export default {
|
|||
&& glass.glassName === damageLocationsSelected.PASSENGER
|
||||
))
|
||||
) {
|
||||
windShieldOptions.selectedWindshieldDamageType
|
||||
= damageLocationsSelected.REPLACE;
|
||||
windShieldOptions.selectedWindshieldDamageType = damageLocationsSelected.REPLACE;
|
||||
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.PASSENGER);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,9 @@
|
|||
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';
|
||||
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
/** @ignore */
|
||||
function setupMocks({
|
||||
modelValueProp = ['Two'],
|
||||
groupName = 'WindshieldChipCountQuestion',
|
||||
|
|
@ -55,3 +36,24 @@ function setupMocks({
|
|||
const damageOptions = dataFromStoreApi;
|
||||
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>
|
||||
|
||||
<script>
|
||||
import buttonQuestion from '@/digital-components/button-question/button-question';
|
||||
import buttonQuestion from '@/digital-components/button-question/button-question.vue';
|
||||
|
||||
export default {
|
||||
name: 'windshield-options',
|
||||
|
|
|
|||
|
|
@ -1,22 +1,9 @@
|
|||
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';
|
||||
|
||||
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' }]);
|
||||
});
|
||||
});
|
||||
|
||||
/** @ignore */
|
||||
function setupMocks({
|
||||
modelValueProp = '',
|
||||
groupName = 'WindshieldDamageTypeQuestion',
|
||||
|
|
@ -42,10 +29,25 @@ function setupMocks({
|
|||
|
||||
// Mock CMS content
|
||||
const cmsContent = {
|
||||
groupName: groupName,
|
||||
groupName,
|
||||
QuestionText: cmsQuestionText,
|
||||
Answers: cmsAnswers
|
||||
};
|
||||
const damageOptions = dataFromStoreApi;
|
||||
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>
|
||||
|
||||
<script>
|
||||
import buttonQuestion from '@/digital-components/button-question/button-question';
|
||||
import buttonQuestion from '@/digital-components/button-question/button-question.vue';
|
||||
|
||||
export default {
|
||||
name: 'windshield-damage-type-question',
|
||||
|
|
|
|||
|
|
@ -40,11 +40,11 @@
|
|||
|
||||
<script>
|
||||
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
|
||||
'@/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question';
|
||||
import replaceOptionsQuestion from '@/layouts/vehicle-damage/replace-options-question/replace-options-question';
|
||||
import alert from '@/ux-components/alert/alert';
|
||||
'@/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.vue';
|
||||
import alert from '@/ux-components/alert/alert.vue';
|
||||
|
||||
import { defineRule } from 'vee-validate';
|
||||
import { required } from '@/helpers/validation-rules';
|
||||
|
|
@ -182,8 +182,8 @@ export default {
|
|||
},
|
||||
windshieldDamageTypeQuestionValidationRules() {
|
||||
// Note: the validation rules string is not dynamic (it cannot be changed once component has been created)
|
||||
let validationRules
|
||||
= 'windshield-damage-type-required|check-for-repair-and-replace:@DamageLocationQuestion';
|
||||
let validationRules =
|
||||
'windshield-damage-type-required|check-for-repair-and-replace:@DamageLocationQuestion';
|
||||
// if vehicle has no windshield replacement option
|
||||
if (!this.isWindshieldReplaceAvailable) {
|
||||
validationRules = validationRules.concat('|repair-only');
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* eslint-env jest */
|
||||
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 { GaActions } from '@/constants/analytics';
|
||||
import vinLookupMethodSelections from '@/constants/vin-lookup-methods';
|
||||
|
|
@ -11,7 +11,7 @@ import { defineRule } from 'vee-validate';
|
|||
import errorMessages from '@/constants/error-messages';
|
||||
import globalRules from '@/constants/global-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();
|
||||
useMainStore(pinia);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<Form
|
||||
@submit="onSubmit"
|
||||
@invalid-submit="onInvalidSubmit">
|
||||
@invalidSubmit="onInvalidSubmit">
|
||||
<div class="page-container-grouped-styles">
|
||||
<div class="fade-on-route-transition position-relative">
|
||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||
|
|
@ -26,8 +26,8 @@
|
|||
cmsWidgetName="SiteFooterWidget"
|
||||
:isForwardActionDisabled="isForwardActionDisabled"
|
||||
class="mt-5"
|
||||
@back-clicked="backButtonAction"
|
||||
@forward-clicked="forwardButtonAction" />
|
||||
@backClicked="backButtonAction"
|
||||
@forwardClicked="forwardButtonAction" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -44,14 +44,13 @@ import { settleAllPromises } from '@/helpers/layout-helper';
|
|||
import { Form } from 'vee-validate';
|
||||
import BaseFormMixin from '@/mixins/base-form-mixin';
|
||||
import vinLookupMethodSelections from '@/constants/vin-lookup-methods';
|
||||
import { useMainStore } from '@/store';
|
||||
|
||||
// Import Component
|
||||
import SiteFooter from '@/iss-components/site-footer/site-footer';
|
||||
import SiteHeader from '@/iss-components/site-header/site-header';
|
||||
import SiteSubHeader from '@/iss-components/site-sub-header/site-sub-header';
|
||||
import VehicleBanner from '@/iss-components/vehicle-banner/vehicle-banner';
|
||||
import VinLookupMethods from '@/layouts/vehicle-lookup/vin-lookup-methods/vin-lookup-methods';
|
||||
import SiteFooter from '@/iss-components/site-footer/site-footer.vue';
|
||||
import SiteHeader from '@/iss-components/site-header/site-header.vue';
|
||||
import SiteSubHeader from '@/iss-components/site-sub-header/site-sub-header.vue';
|
||||
import VehicleBanner from '@/iss-components/vehicle-banner/vehicle-banner.vue';
|
||||
import VinLookupMethods from '@/layouts/vehicle-lookup/vin-lookup-methods/vin-lookup-methods.vue';
|
||||
|
||||
export default {
|
||||
name: 'vehicle-lookup',
|
||||
|
|
@ -105,17 +104,17 @@ export default {
|
|||
},
|
||||
forwardButtonAction() {
|
||||
switch (this.selectedVinLookupMethod) {
|
||||
case vinLookupMethodSelections.MANUALVIN:
|
||||
this.$router.navigate(this.navigationScenarios.SELECTED_MANUAL_VIN, this.$route);
|
||||
break;
|
||||
case vinLookupMethodSelections.LICENSEPLATE:
|
||||
this.$router.navigate(this.navigationScenarios.SELECTED_LICENSE_PLATE, this.$route);
|
||||
break;
|
||||
case vinLookupMethodSelections.HOMEADDRESS:
|
||||
this.$router.navigate(this.navigationScenarios.SELECTED_HOME_ADDRESS, this.$route);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case vinLookupMethodSelections.MANUALVIN:
|
||||
this.$router.navigate(this.navigationScenarios.SELECTED_MANUAL_VIN, this.$route);
|
||||
break;
|
||||
case vinLookupMethodSelections.LICENSEPLATE:
|
||||
this.$router.navigate(this.navigationScenarios.SELECTED_LICENSE_PLATE, this.$route);
|
||||
break;
|
||||
case vinLookupMethodSelections.HOMEADDRESS:
|
||||
this.$router.navigate(this.navigationScenarios.SELECTED_HOME_ADDRESS, this.$route);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
resetDependentState() {}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import { settleAllPromises } from '@/helpers/layout-helper';
|
|||
import globalRules from '@/constants/global-rules';
|
||||
|
||||
// Import Component
|
||||
import ButtonQuestion from '@/digital-components/button-question/button-question';
|
||||
import ButtonQuestion from '@/digital-components/button-question/button-question.vue';
|
||||
|
||||
export default {
|
||||
name: 'vin-lookup-methods',
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { shallowMount } from '@vue/test-utils';
|
||||
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';
|
||||
|
||||
const featureListData = {
|
||||
|
|
@ -23,6 +23,34 @@ const featureListData = {
|
|||
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', () => {
|
||||
test('Part data passed in, should map data for ButtonQuestion (radio type)', async () => {
|
||||
// Arrange
|
||||
|
|
@ -31,7 +59,7 @@ describe('glass-part-question.vue', () => {
|
|||
// Act
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
console.log(wrapper.vm.featureListData['Green Tint'][0].Text);
|
||||
window.console.log(wrapper.vm.featureListData['Green Tint'][0].Text);
|
||||
// Assert
|
||||
expect(Object.keys(wrapper.vm.featureListData).length).toBe(2);
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
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>
|
||||
// Components
|
||||
import buttonQuestion from '@/digital-components/button-question/button-question';
|
||||
import buttonQuestion from '@/digital-components/button-question/button-question.vue';
|
||||
|
||||
// Supporting files
|
||||
import getTintImage from '@/constants/tint-mapper';
|
||||
|
|
@ -102,8 +102,7 @@ export default {
|
|||
tintOptions.push({
|
||||
value: tintOption,
|
||||
buttonLabel: tintOption,
|
||||
buttonImage: require(`@/assets/img/tints/${this.getTintSourceImage(this.glassLocation,
|
||||
tintOption)}`)
|
||||
buttonImage: require(`@/assets/img/tints/${this.getTintSourceImage(this.glassLocation, tintOption)}`)
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Components
|
||||
import vehicleParts from '@/layouts/vehicle-parts/vehicle-parts';
|
||||
import glassPartQuestion from '@/layouts/vehicle-parts/glass-part-question/glass-part-question';
|
||||
import vehicleParts from '@/layouts/vehicle-parts/vehicle-parts.vue';
|
||||
import glassPartQuestion from '@/layouts/vehicle-parts/glass-part-question/glass-part-question.vue';
|
||||
|
||||
// Supporting Files
|
||||
import { settleAllPromises } from '@/helpers/layout-helper.js';
|
||||
|
|
@ -10,7 +10,7 @@ import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
|||
import { nextTick } from 'vue';
|
||||
import baseMixin from '@/mixins/base-mixin.js';
|
||||
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';
|
||||
|
||||
// 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', () => {
|
||||
test('Set cms content called on load', async () => {
|
||||
// Arrange
|
||||
|
|
@ -295,7 +339,12 @@ describe('vehicle-parts.vue', () => {
|
|||
|
||||
// Assert
|
||||
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 () => {
|
||||
|
|
@ -356,49 +405,10 @@ describe('vehicle-parts.vue', () => {
|
|||
|
||||
// Assert
|
||||
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
|
||||
ref="theForm"
|
||||
@submit="onSubmit"
|
||||
@invalid-submit="onInvalidSubmit">
|
||||
@invalidSubmit="onInvalidSubmit">
|
||||
<div class="page-container-grouped-styles">
|
||||
<div class="fade-on-route-transition position-relative">
|
||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||
|
|
@ -187,7 +187,9 @@ export default {
|
|||
const matchedParts = [];
|
||||
|
||||
// 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)) {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const [partKey, partValue] of Object.entries(value.parts)) {
|
||||
const currentPart = this.PartsFromApi.partsOrQuestions[key].parts[partKey];
|
||||
|
||||
|
|
@ -213,10 +215,9 @@ export default {
|
|||
|
||||
LoadInitialPartsData() {
|
||||
const partsData = this.PartsFromApi;
|
||||
this.alreadyPopulatedPartsData
|
||||
= this.mainStore.lineItems.glassParts === null
|
||||
? []
|
||||
: this.mainStore.lineItems.glassParts;
|
||||
this.alreadyPopulatedPartsData = this.mainStore.lineItems.glassParts === null
|
||||
? []
|
||||
: this.mainStore.lineItems.glassParts;
|
||||
|
||||
partsData.partsOrQuestions.map((g) => {
|
||||
// If the part is already populated, use the value from the store and populate the v-model.
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
<script>
|
||||
|
||||
import dropdownQuestion from '@/digital-components/dropdown-question/dropdown-question';
|
||||
import dropdownQuestion from '@/digital-components/dropdown-question/dropdown-question.vue';
|
||||
|
||||
export default {
|
||||
name: 'vehicle-question',
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
ref="theForm"
|
||||
v-slot="{ meta }"
|
||||
@submit="onSubmit"
|
||||
@invalid-submit="onInvalidSubmit">
|
||||
@invalidSubmit="onInvalidSubmit">
|
||||
<div class="page-container-grouped-styles position-relative">
|
||||
<div class="fade-on-route-transition position-relative">
|
||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||
|
|
@ -63,7 +63,7 @@
|
|||
cmsWidgetName="SiteFooterWidget"
|
||||
:isForwardActionDisabled="!meta.valid"
|
||||
@ForwardClicked="forwardButtonAction"
|
||||
@back-clicked="backButtonAction" />
|
||||
@backClicked="backButtonAction" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -76,11 +76,11 @@
|
|||
|
||||
<script>
|
||||
// Components
|
||||
import siteHeader from '@/iss-components/site-header/site-header';
|
||||
import siteFooter from '@/iss-components/site-footer/site-footer';
|
||||
import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header';
|
||||
import vehicleBanner from '@/iss-components/vehicle-banner/vehicle-banner';
|
||||
import vehicleQuestion from '@/layouts/vehicle-selection/vehicle-question/vehicle-question';
|
||||
import siteHeader from '@/iss-components/site-header/site-header.vue';
|
||||
import siteFooter from '@/iss-components/site-footer/site-footer.vue';
|
||||
import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header.vue';
|
||||
import vehicleBanner from '@/iss-components/vehicle-banner/vehicle-banner.vue';
|
||||
import vehicleQuestion from '@/layouts/vehicle-selection/vehicle-question/vehicle-question.vue';
|
||||
import { useMainStore } from '@/store';
|
||||
|
||||
// Supporting files
|
||||
|
|
@ -195,16 +195,16 @@ export default {
|
|||
});
|
||||
},
|
||||
async updateYearValues() {
|
||||
return await useMainStore().getVehicleYears();
|
||||
return useMainStore().getVehicleYears();
|
||||
},
|
||||
async updateMakeValues() {
|
||||
return await this.mainStore.getVehicleMakes();
|
||||
return this.mainStore.getVehicleMakes();
|
||||
},
|
||||
async updateModelValues() {
|
||||
return await this.mainStore.getVehicleModels();
|
||||
return this.mainStore.getVehicleModels();
|
||||
},
|
||||
async updateStyleValues() {
|
||||
return await this.mainStore.getVehicleStyles();
|
||||
return this.mainStore.getVehicleStyles();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import textLink from '@/ux-components/text-link/text-link';
|
||||
import textLink from '@/ux-components/text-link/text-link.vue';
|
||||
|
||||
export default {
|
||||
name: 'vin-location-information',
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
aria-label="perfect-match-alert" />
|
||||
</template>
|
||||
<script>
|
||||
import alert from '@/ux-components/alert/alert';
|
||||
import alert from '@/ux-components/alert/alert.vue';
|
||||
import { getDamageString } from '@/helpers/damage-helper';
|
||||
|
||||
export default {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<script>
|
||||
import { getDamageString } from '@/helpers/damage-helper';
|
||||
|
||||
import alert from '@/ux-components/alert/alert';
|
||||
import alert from '@/ux-components/alert/alert.vue';
|
||||
|
||||
export default {
|
||||
name: 'two-identical-ymm-vehicle-alert',
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
aria-label="vehicle-not-found-alert" />
|
||||
</template>
|
||||
<script>
|
||||
import alert from '@/ux-components/alert/alert';
|
||||
import alert from '@/ux-components/alert/alert.vue';
|
||||
|
||||
export default {
|
||||
name: 'vehicle-not-found-alert',
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<script>
|
||||
import { getDamageString } from '@/helpers/damage-helper';
|
||||
|
||||
import alert from '@/ux-components/alert/alert';
|
||||
import alert from '@/ux-components/alert/alert.vue';
|
||||
|
||||
export default {
|
||||
name: 'vehicle-not-matched-alert',
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import vehicleLookupAlertTypes from '@/constants/vehicle-lookup-alert-types';
|
|||
import { RouterLinkStub } from '@vue/test-utils';
|
||||
import { render } from '@testing-library/vue';
|
||||
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');
|
||||
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@
|
|||
</template>
|
||||
<script>
|
||||
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 vehicleNotMatchedAlert from '@/layouts/vin-lookup/vin-lookup-alerts/vehicle-not-matched-alert/vehicle-not-matched-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.vue';
|
||||
import twoIdenticalYMMVehicleAlert from
|
||||
'@/layouts/vin-lookup/vin-lookup-alerts/two-identical-ymm-vehicle-alert/two-identical-ymm-vehicle-alert';
|
||||
import perfectMatchAlert from '@/layouts/vin-lookup/vin-lookup-alerts//perfect-match-alert/perfect-match-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.vue';
|
||||
|
||||
export default {
|
||||
name: 'vin-lookup-alerts',
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import errorMessages from '@/constants/error-messages';
|
|||
import issPageValues from '@/router/router-constants/issPage-values';
|
||||
import queryStrings from '@/constants/query-strings';
|
||||
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 { useMainStore } from '@/store';
|
||||
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);
|
||||
});
|
||||
|
||||
// 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 () => {
|
||||
const user = userEvent.setup();
|
||||
mountOptions.global.stubs.vinQuestion = false;
|
||||
|
|
@ -305,16 +306,15 @@ describe('vin-lookup.vue', () => {
|
|||
await flushPromises();
|
||||
await waitFor(() => {
|
||||
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
||||
expect(mockRouter.navigate).toHaveBeenCalledWith(
|
||||
navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS,
|
||||
expect(mockRouter.navigate).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS,
|
||||
mockRoute,
|
||||
{},
|
||||
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true }
|
||||
);
|
||||
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true });
|
||||
});
|
||||
});
|
||||
|
||||
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 () => {
|
||||
const user = userEvent.setup();
|
||||
mountOptions.global.stubs.vinQuestion = false;
|
||||
|
|
@ -336,16 +336,15 @@ describe('vin-lookup.vue', () => {
|
|||
await waitFor(() => {
|
||||
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
||||
expect(mockRouter.navigate)
|
||||
.toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS,
|
||||
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS,
|
||||
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 () => {
|
||||
const user = userEvent.setup();
|
||||
mountOptions.global.stubs.vinQuestion = false;
|
||||
|
|
@ -367,16 +366,15 @@ describe('vin-lookup.vue', () => {
|
|||
await waitFor(() => {
|
||||
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
||||
expect(mockRouter.navigate)
|
||||
.toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE,
|
||||
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE,
|
||||
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 () => {
|
||||
const user = userEvent.setup();
|
||||
mountOptions.global.stubs.vinQuestion = false;
|
||||
|
|
@ -398,16 +396,15 @@ describe('vin-lookup.vue', () => {
|
|||
await waitFor(() => {
|
||||
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
||||
expect(mockRouter.navigate)
|
||||
.toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS,
|
||||
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS,
|
||||
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 () => {
|
||||
const user = userEvent.setup();
|
||||
const store = useMainStore();
|
||||
|
|
@ -432,16 +429,15 @@ describe('vin-lookup.vue', () => {
|
|||
await waitFor(() => {
|
||||
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
||||
expect(mockRouter.navigate)
|
||||
.toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS,
|
||||
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS,
|
||||
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 () => {
|
||||
const user = userEvent.setup();
|
||||
mountOptions.global.stubs.vinQuestion = false;
|
||||
|
|
@ -464,15 +460,13 @@ describe('vin-lookup.vue', () => {
|
|||
await waitFor(() => {
|
||||
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
||||
expect(mockRouter.navigate)
|
||||
.toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
|
||||
mockRoute
|
||||
);
|
||||
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
|
||||
mockRoute);
|
||||
});
|
||||
});
|
||||
|
||||
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();
|
||||
lookupVehicleByVin.mockResponse.data.error = true;
|
||||
|
||||
|
|
@ -492,10 +486,8 @@ describe('vin-lookup.vue', () => {
|
|||
await flushPromises();
|
||||
await waitFor(() => {
|
||||
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
||||
expect(mockRouter.navigate).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_WITH_BAILOUT,
|
||||
mockRoute
|
||||
);
|
||||
expect(mockRouter.navigate).toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_BAILOUT,
|
||||
mockRoute);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
ref="theForm"
|
||||
v-slot="{ meta }"
|
||||
@submit="onSubmit"
|
||||
@invalid-submit="onInvalidSubmit">
|
||||
@invalidSubmit="onInvalidSubmit">
|
||||
<div class="page-container-grouped-styles">
|
||||
<div class="fade-on-route-transition position-relative">
|
||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||
|
|
@ -130,6 +130,7 @@ export default {
|
|||
return (vinYmmFound.toLowerCase() === vinYmmExpected.toLowerCase());
|
||||
},
|
||||
vinMask() {
|
||||
// TODO: Side effects in computed.
|
||||
if (this.vinPopulatedOnPageLoad) {
|
||||
// TODO: Modify to remove side effects in computed
|
||||
this.activeVehicleLookupAlertType = vehicleLookupAlertTypes.PERFECT_MATCH;
|
||||
|
|
@ -241,6 +242,8 @@ export default {
|
|||
|
||||
// Comes from vehicleQuestionsMixin.navigateForward()
|
||||
await this.navigateForward(partsOrQuestionsResponse.data.partsOrQuestions, this);
|
||||
|
||||
return null;
|
||||
},
|
||||
async getPartsOrQuestions() {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import { regex, required } from '@/helpers/validation-rules';
|
|||
import errorMessages from '@/constants/error-messages';
|
||||
|
||||
// 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-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 applicationConfig from '@/constants/application-config';
|
||||
import { useMainStore } from '@/store';
|
||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
|
||||
import navigationScenarios from '@/router/router-constants/navigation-scenarios';
|
||||
|
||||
// Mock our module for promises.
|
||||
jest.mock('@/helpers/layout-helper.js', () => ({
|
||||
|
|
|
|||
|
|
@ -1,9 +1,15 @@
|
|||
<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="fade-on-route-transition position-relative">
|
||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||
<siteSubHeader cmsWidgetName="SiteSubHeaderWidget" class="mt-4" />
|
||||
<siteSubHeader
|
||||
cmsWidgetName="SiteSubHeaderWidget"
|
||||
class="mt-4" />
|
||||
<div class="container-fluid px-5">
|
||||
<div class="row mt-5">
|
||||
<div class="col">
|
||||
|
|
@ -18,7 +24,9 @@
|
|||
:validationRules="rules.policyNumber" />
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="isCoverageEnabled" class="row mt-4">
|
||||
<div
|
||||
v-if="isCoverageEnabled"
|
||||
class="row mt-4">
|
||||
<div class="col">
|
||||
<textboxQuestion
|
||||
ref="policyZip"
|
||||
|
|
@ -138,13 +146,15 @@
|
|||
isSmallQuestionLabelText
|
||||
disableAutoFill />
|
||||
</div>
|
||||
<div id="welcomeFooter" class="row position-sticky top-100">
|
||||
<div
|
||||
id="welcomeFooter"
|
||||
class="row position-sticky top-100">
|
||||
<div class="col">
|
||||
<siteFooter
|
||||
class="mt-3"
|
||||
cmsWidgetName="SiteFooterWidget"
|
||||
:isForwardActionDisabled="!meta.valid"
|
||||
@back-clicked="backButtonAction"
|
||||
@backClicked="backButtonAction"
|
||||
@ForwardClicked="forwardButtonAction" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -156,13 +166,13 @@
|
|||
|
||||
<script>
|
||||
// Components
|
||||
import siteHeader from '@/iss-components/site-header/site-header';
|
||||
import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header';
|
||||
import siteFooter from '@/iss-components/site-footer/site-footer';
|
||||
import textboxQuestion from '@/digital-components/textbox-question/textbox-question';
|
||||
import buttonQuestion from '@/digital-components/button-question/button-question';
|
||||
import dropdownQuestion from '@/digital-components/dropdown-question/dropdown-question';
|
||||
import textBlock from '@/digital-components/text-block/text-block';
|
||||
import siteHeader from '@/iss-components/site-header/site-header.vue';
|
||||
import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header.vue';
|
||||
import siteFooter from '@/iss-components/site-footer/site-footer.vue';
|
||||
import textboxQuestion from '@/digital-components/textbox-question/textbox-question.vue';
|
||||
import buttonQuestion from '@/digital-components/button-question/button-question.vue';
|
||||
import dropdownQuestion from '@/digital-components/dropdown-question/dropdown-question.vue';
|
||||
import textBlock from '@/digital-components/text-block/text-block.vue';
|
||||
|
||||
// Supporting files
|
||||
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('damage-option-required', required(errorMessages.DAMAGE_OPTION_REQUIRED));
|
||||
defineRule('policy-zip-required', required(errorMessages.POLICY_ZIP_REQUIRED));
|
||||
defineRule(
|
||||
'policy-zip-format',
|
||||
regex(/(^\d{5}$)|(^\d{5}-\d{4}$)/, errorMessages.POLICY_ZIP_FORMAT)
|
||||
);
|
||||
defineRule('policy-zip-format',
|
||||
regex(/(^\d{5}$)|(^\d{5}-\d{4}$)/, errorMessages.POLICY_ZIP_FORMAT));
|
||||
|
||||
export default {
|
||||
name: 'welcome-page',
|
||||
|
|
@ -249,6 +257,7 @@ export default {
|
|||
const damageCauseAnswers = this.getCmsContent('DamageCauseQuestion', 'Answers');
|
||||
const damageCauseAnswersObj = {};
|
||||
if (damageCauseAnswers) {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const answer of Object.values(damageCauseAnswers)) {
|
||||
if (answer?.Name) {
|
||||
damageCauseAnswersObj[answer.Name] = answer.Name;
|
||||
|
|
@ -334,27 +343,21 @@ export default {
|
|||
if (policy) {
|
||||
if (this.vehiclesFound) {
|
||||
// if policy lookup is successful and vehicles are found, navigate to policy-vehicles page
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
|
||||
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
|
||||
this.$route,
|
||||
{},
|
||||
{},
|
||||
this.vehiclesFound
|
||||
);
|
||||
this.vehiclesFound);
|
||||
} else {
|
||||
// if policy lookup is successful, but no vehicles are associated with the policy
|
||||
// navigate to vehicle-selection page (manual entry)
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
|
||||
this.$route
|
||||
);
|
||||
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
|
||||
this.$route);
|
||||
}
|
||||
} else {
|
||||
// if policy lookup is unsuccessful, navigate to policy-holder-details page
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
|
||||
this.$route
|
||||
);
|
||||
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
|
||||
this.$route);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,19 @@ import {
|
|||
import cookieNames from '@/constants/cookie-names';
|
||||
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 {
|
||||
methods: {
|
||||
getPageNameByQueryString() {
|
||||
|
|
@ -102,8 +115,7 @@ export default {
|
|||
let googleDimensionIndex = 99;
|
||||
|
||||
if (exp.settings[experimentSettings.GOOGLE_CUSTOM_DIMENSION_INDEX] !== undefined) {
|
||||
googleDimensionIndex
|
||||
= exp.settings[experimentSettings.GOOGLE_CUSTOM_DIMENSION_INDEX];
|
||||
googleDimensionIndex = exp.settings[experimentSettings.GOOGLE_CUSTOM_DIMENSION_INDEX];
|
||||
}
|
||||
|
||||
// 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 { setupMocksForJsFiles, setupCookies } from '@/helpers/unit-test-helper.js';
|
||||
import { setupCookies } from '@/helpers/unit-test-helper.js';
|
||||
import {
|
||||
analyticsPageEvents,
|
||||
GaCategories,
|
||||
|
|
@ -74,6 +74,7 @@ describe('analyticsMixin.js', () => {
|
|||
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', () => {
|
||||
// Arrange
|
||||
window.dataLayer = [];
|
||||
|
|
|
|||
|
|
@ -1,16 +1,17 @@
|
|||
export default {
|
||||
methods: {
|
||||
onSubmit() {
|
||||
/** DO NOT REMOVE;
|
||||
* Needed to prevent default form submit behavior.
|
||||
* Cannot use .prevent modifier for vee-validate Form.
|
||||
*/
|
||||
/**
|
||||
* DO NOT REMOVE;
|
||||
* Needed to prevent default form submit behavior.
|
||||
* Cannot use .prevent modifier for vee-validate Form.
|
||||
*/
|
||||
},
|
||||
onInvalidSubmit({ errors }) {
|
||||
/**
|
||||
* Identify the first error field and put focus on it
|
||||
* get error names array
|
||||
*/
|
||||
/**
|
||||
* Identify the first error field and put focus on it
|
||||
* get error names array
|
||||
*/
|
||||
const errorNames = errors ? Object.keys(errors) : [];
|
||||
const firstErrorEl = errorNames[0];
|
||||
if (firstErrorEl) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { mapStores } from 'pinia';
|
||||
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 queryStrings from '@/constants/query-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 { 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('hasSettingEqualTo', () => {
|
||||
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 { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
|
||||
import navigationScenarios from '@/router/router-constants/navigation-scenarios';
|
||||
import { useMainStore } from '@/store';
|
||||
|
||||
export default {
|
||||
|
|
@ -106,8 +106,7 @@ export default {
|
|||
}
|
||||
|
||||
// mark this question as answered (question-chain will read this)
|
||||
glass.questions[answeredQuestion.questionNum - 1].answerSelected
|
||||
= answerString;
|
||||
glass.questions[answeredQuestion.questionNum - 1].answerSelected = answerString;
|
||||
// mark this question as suppressed if needed (question-chain uses this)
|
||||
if (answeredQuestion.suppressThisQuestion) {
|
||||
glass.questions[
|
||||
|
|
@ -351,8 +350,7 @@ export default {
|
|||
const currentPage = self.$route.query.issPage;
|
||||
|
||||
const hasPartQuestions = this.hasPartQuestions(partsOrQuestions);
|
||||
const hasGlassLocationWithMultipleParts
|
||||
= this.hasGlassLocationWithMultipleParts(partsOrQuestions);
|
||||
const hasGlassLocationWithMultipleParts = this.hasGlassLocationWithMultipleParts(partsOrQuestions);
|
||||
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
|
||||
const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions);
|
||||
|
||||
|
|
@ -385,6 +383,7 @@ export default {
|
|||
// go to capability-questions page and pass the partsData
|
||||
|
||||
// mimic part-questions page data for consistency
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const partOrQuestion of partsOrQuestions) {
|
||||
if (this.hasCapabilityQuestions([partOrQuestion])) {
|
||||
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)
|
||||
)?.partsOrQuestions;
|
||||
const hasPartQuestions = this.hasPartQuestions(partsOrQuestions);
|
||||
const hasGlassLocationWithMultipleParts
|
||||
= this.hasGlassLocationWithMultipleParts(partsOrQuestions);
|
||||
const hasGlassLocationWithMultipleParts = this.hasGlassLocationWithMultipleParts(partsOrQuestions);
|
||||
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
|
||||
const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions);
|
||||
let backNavigationScenario = '';
|
||||
|
|
@ -453,8 +451,7 @@ export default {
|
|||
hasGlassLocationWithMultipleParts
|
||||
&& this.currentPageComesAfterPage(currentPage, issPageValues.VEHICLE_PARTS)
|
||||
) {
|
||||
backNavigationScenario
|
||||
= navigationScenarios.CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE;
|
||||
backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE;
|
||||
} else if (
|
||||
hasPartQuestions
|
||||
&& this.currentPageComesAfterPage(currentPage, issPageValues.PART_QUESTIONS)
|
||||
|
|
|
|||
|
|
@ -2,9 +2,53 @@ import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin';
|
|||
import { shallowMount } from '@vue/test-utils';
|
||||
import { setupMocksForJsFiles, getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||
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';
|
||||
|
||||
/** @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', () => {
|
||||
afterEach(() => {
|
||||
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 { useMainStore } from '@/store';
|
||||
|
||||
/** @ignore */
|
||||
function setupMocks() {
|
||||
const mocks = getMountOptions({
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
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 { routingTable } from '@/router/router-constants/routing-table';
|
||||
import { useMainStore } from '@/store';
|
||||
|
|
@ -15,7 +15,7 @@ import { experimentTriggers } from '@/constants/experiments';
|
|||
import applicationConfig from '@/constants/application-config';
|
||||
|
||||
import analyticsMixin from '@/mixins/analytics-mixin';
|
||||
import { navigationScenarios } from './router-constants/navigation-scenarios';
|
||||
import navigationScenarios from './router-constants/navigation-scenarios';
|
||||
|
||||
const routes = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const navigationScenarios = {
|
||||
const navigationScenarios = Object.freeze({
|
||||
// General
|
||||
CLICKED_BACK: 'CLICKED_BACK',
|
||||
CLICKED_BACK_PREVIOUS: 'CLICKED_BACK_PREVIOUS',
|
||||
|
|
@ -64,6 +64,6 @@ const navigationScenarios = {
|
|||
|
||||
// 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 { 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
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
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 { createApp } from 'vue';
|
||||
import { createPinia } from 'pinia';
|
||||
|
|
|
|||
Loading…
Reference in a new issue