Merge branch 'develop' into feature/digital/SSR-332
This commit is contained in:
commit
36f73800d6
2 changed files with 58 additions and 45 deletions
|
|
@ -8,7 +8,6 @@ import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
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";
|
||||||
|
|
||||||
// Mock our module for promises.
|
// Mock our module for promises.
|
||||||
jest.mock("@/helpers/layout-helper.js", () => ({
|
jest.mock("@/helpers/layout-helper.js", () => ({
|
||||||
settleAllPromises: jest.fn(),
|
settleAllPromises: jest.fn(),
|
||||||
|
|
@ -16,14 +15,17 @@ jest.mock("@/helpers/layout-helper.js", () => ({
|
||||||
|
|
||||||
// Mock fetchCmsContentForPage
|
// Mock fetchCmsContentForPage
|
||||||
jest.mock("@/helpers/cms-content-helper", () => ({
|
jest.mock("@/helpers/cms-content-helper", () => ({
|
||||||
fetchCmsContentForPage: jest.fn(),
|
fetchCmsContentForPage: jest.fn()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
describe("welcome-page.vue", () => {
|
describe("welcome-page.vue", () => {
|
||||||
test("Should render welcomePage sub-components (policyNumber, policyZipCode, dateOfLoss, damageCause etc.)", async () => {
|
test("Should render welcomePage sub-components (policyNumber, policyZipCode, dateOfLoss, damageCause etc.)", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({});
|
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const policyNumber = wrapper.findComponent({ ref: "policyNumber" });
|
const policyNumber = wrapper.findComponent({ ref: "policyNumber" });
|
||||||
const dateOfLoss = wrapper.findComponent({ ref: "dateOfLoss" });
|
const dateOfLoss = wrapper.findComponent({ ref: "dateOfLoss" });
|
||||||
|
|
@ -39,8 +41,8 @@ describe("welcome-page.vue", () => {
|
||||||
expect(policyNumber.exists()).toBe(true);
|
expect(policyNumber.exists()).toBe(true);
|
||||||
expect(dateOfLoss.exists()).toBe(true);
|
expect(dateOfLoss.exists()).toBe(true);
|
||||||
expect(damageCause.exists()).toBe(true);
|
expect(damageCause.exists()).toBe(true);
|
||||||
expect(damageCity.exists()).toBe(true);
|
expect(damageCity.exists()).toBe(false);
|
||||||
expect(state.exists()).toBe(true);
|
expect(state.exists()).toBe(false);
|
||||||
expect(glassOnlyDamage.exists()).toBe(true);
|
expect(glassOnlyDamage.exists()).toBe(true);
|
||||||
expect(phoneNumber.exists()).toBe(true);
|
expect(phoneNumber.exists()).toBe(true);
|
||||||
expect(email.exists()).toBe(true);
|
expect(email.exists()).toBe(true);
|
||||||
|
|
@ -74,6 +76,8 @@ function setupMocks({
|
||||||
router: {
|
router: {
|
||||||
navigate: jest.fn(),
|
navigate: jest.fn(),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const apiPromise = Promise.resolve(apiResponses);
|
const apiPromise = Promise.resolve(apiResponses);
|
||||||
|
|
@ -86,7 +90,7 @@ function setupMocks({
|
||||||
const wrapper = shallowMount(welcomePage, mountOptions);
|
const wrapper = shallowMount(welcomePage, mountOptions);
|
||||||
|
|
||||||
wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent;
|
wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent;
|
||||||
|
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => "");
|
||||||
return { wrapper, apiPromise };
|
return { wrapper, apiPromise };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row px-5">
|
<div class="row px-5">
|
||||||
<div class="col">
|
<div class="col px-0">
|
||||||
<textBlock cmsWidgetName="DamageDateEstimateWidget" typeStyle="caption" class="mt-2" />
|
<textBlock cmsWidgetName="DamageDateEstimateWidget" typeStyle="small" class="mt-2" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mt-4 px-3">
|
<div class="row mt-4 px-3">
|
||||||
|
|
@ -54,34 +54,7 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mt-4 px-3">
|
|
||||||
<div class="col">
|
|
||||||
<textboxQuestion
|
|
||||||
inputId="damageCityField"
|
|
||||||
cmsWidgetName="DamageCityQuestion"
|
|
||||||
v-model="welcomePageModel.damageCity"
|
|
||||||
isRequired
|
|
||||||
ref="damageCity"
|
|
||||||
disableAutoFill
|
|
||||||
validationRules="loss-city-required" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row mt-4 px-3">
|
|
||||||
<div class="col">
|
|
||||||
<dropdownQuestion
|
|
||||||
cmsWidgetName="DamageStateQuestion"
|
|
||||||
v-model="welcomePageModel.damageState"
|
|
||||||
ref="state"
|
|
||||||
inputId="8fdf9dc2e13e430eb57529499dceb3eb"
|
|
||||||
:options="stateOptions"
|
|
||||||
validationRules="loss-state-required"
|
|
||||||
isRequired
|
|
||||||
disableAutoFill
|
|
||||||
placeHolderText="Select an option"
|
|
||||||
id="welcomeDropdown"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row mt-4">
|
<div class="row mt-4">
|
||||||
<buttonQuestion
|
<buttonQuestion
|
||||||
class="px-0"
|
class="px-0"
|
||||||
|
|
@ -121,6 +94,36 @@
|
||||||
disableAutoFill />
|
disableAutoFill />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row mt-4 px-3">
|
||||||
|
<div class="col">
|
||||||
|
<textboxQuestion
|
||||||
|
inputId="damageCityField"
|
||||||
|
cmsWidgetName="DamageCityQuestion"
|
||||||
|
v-model="welcomePageModel.damageCity"
|
||||||
|
isRequired
|
||||||
|
ref="damageCity"
|
||||||
|
disableAutoFill
|
||||||
|
v-if="this.displayDamageCityQuestion"
|
||||||
|
validationRules="loss-city-required" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mt-4 px-3">
|
||||||
|
<div class="col">
|
||||||
|
<dropdownQuestion
|
||||||
|
cmsWidgetName="DamageStateQuestion"
|
||||||
|
v-model="welcomePageModel.damageState"
|
||||||
|
ref="state"
|
||||||
|
inputId="8fdf9dc2e13e430eb57529499dceb3eb"
|
||||||
|
:options="stateOptions"
|
||||||
|
validationRules="loss-state-required"
|
||||||
|
isRequired
|
||||||
|
disableAutoFill
|
||||||
|
v-if="this.displayDamageStateQuestion"
|
||||||
|
placeHolderText="Select an option"
|
||||||
|
id="welcomeDropdown"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row mt-4 position-sticky top-100" id="welcomeFooter">
|
<div class="row mt-4 position-sticky top-100" id="welcomeFooter">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<site-footer
|
<site-footer
|
||||||
|
|
@ -320,6 +323,12 @@
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
displayDamageCityQuestion(){
|
||||||
|
return !!this.getCmsContent("DamageCityQuestion","QuestionText");
|
||||||
|
},
|
||||||
|
displayDamageStateQuestion(){
|
||||||
|
return !!this.getCmsContent("DamageStateQuestion","QuestionText");
|
||||||
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
siteHeader,
|
siteHeader,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue