CASH-2467 recal info page content
CASH-2467 recal info page content
This commit is contained in:
parent
5fc4e958f1
commit
f0abdc0344
3 changed files with 70 additions and 15 deletions
|
|
@ -55,6 +55,15 @@ function setupMocks() {
|
||||||
fetchCmsContentForPage.mockResolvedValue(mockCmsContent);
|
fetchCmsContentForPage.mockResolvedValue(mockCmsContent);
|
||||||
settleAllPromises.mockResolvedValue({ cmsContent: mockCmsContent });
|
settleAllPromises.mockResolvedValue({ cmsContent: mockCmsContent });
|
||||||
|
|
||||||
|
const mockMixin = {
|
||||||
|
methods: {
|
||||||
|
getCmsContent: jest.fn((widgetName, fieldName) => {
|
||||||
|
return mockCmsContent?.[widgetName]?.[fieldName] ?? "";
|
||||||
|
}),
|
||||||
|
setCmsContent: jest.fn(),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const mountOptions = getMountOptions({
|
const mountOptions = getMountOptions({
|
||||||
route: { name: "policy-driver", query: {}, params: {} },
|
route: { name: "policy-driver", query: {}, params: {} },
|
||||||
router: {
|
router: {
|
||||||
|
|
@ -62,6 +71,7 @@ function setupMocks() {
|
||||||
navigateWithSaving: jest.fn(),
|
navigateWithSaving: jest.fn(),
|
||||||
navigateWithoutSaving: jest.fn(),
|
navigateWithoutSaving: jest.fn(),
|
||||||
},
|
},
|
||||||
|
mixins: [mockMixin],
|
||||||
});
|
});
|
||||||
|
|
||||||
const wrapper = shallowMount(policyDriver, mountOptions);
|
const wrapper = shallowMount(policyDriver, mountOptions);
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ describe("recalibration-info.vue", () => {
|
||||||
|
|
||||||
test("renders navbar component", () => {
|
test("renders navbar component", () => {
|
||||||
const { wrapper } = setupMocks();
|
const { wrapper } = setupMocks();
|
||||||
expect(wrapper.findComponent({ name: "insuranceNavBar" }).exists()).toBe(true);
|
expect(wrapper.findComponent({ name: "navbar" }).exists()).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("renders Form component", () => {
|
test("renders Form component", () => {
|
||||||
|
|
|
||||||
|
|
@ -8,15 +8,34 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-md-10 col-lg-8 col-xl-7">
|
<div class="col-12 col-md-10 col-lg-8 col-xl-7">
|
||||||
<funnelSubHeader class="pb-4" cmsWidgetName="FunnelSubHeaderWidget" />
|
<funnelSubHeader
|
||||||
<!--
|
cmsWidgetName="FunnelSubHeaderWidget"
|
||||||
... Page code goes here.
|
class="siteSubHeader mb-4"
|
||||||
-->
|
:alignLeft="true" />
|
||||||
<insuranceNavBar
|
|
||||||
|
<img
|
||||||
|
:src="recalibrationInfoDesktopImage"
|
||||||
|
alt=""
|
||||||
|
class="recal-image recal-image--desktop mb-4" />
|
||||||
|
<img
|
||||||
|
:src="recalibrationInfoMobileImage"
|
||||||
|
alt=""
|
||||||
|
class="recal-image recal-image--mobile mb-4" />
|
||||||
|
|
||||||
|
<div class="adas-body-text mb-7" v-html="adasBodyText"></div>
|
||||||
|
|
||||||
|
<hr class="mb-5" />
|
||||||
|
|
||||||
|
<saveProgressModalQuestion
|
||||||
|
modalWidgetName="SaveProgressModalWidget"
|
||||||
|
modalName="SaveProgressModal"
|
||||||
|
v-if="showSaveProgressModal"
|
||||||
|
pageName="recalibration-info" />
|
||||||
|
|
||||||
|
<navbar
|
||||||
cmsWidgetName="FunnelFooterWidget"
|
cmsWidgetName="FunnelFooterWidget"
|
||||||
ref="navbar"
|
ref="navbar"
|
||||||
:isForwardActionDisabled="!meta.valid"
|
:isForwardActionDisabled="!meta.valid"
|
||||||
@cancel-clicked="cancelButtonAction"
|
|
||||||
@back-clicked="backButtonAction"
|
@back-clicked="backButtonAction"
|
||||||
@ForwardClicked="forwardButtonAction" />
|
@ForwardClicked="forwardButtonAction" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -27,27 +46,34 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import funnelHeader from "@/fmg-components/funnel-header/funnel-header";
|
import funnelHeader from "@/fmg-components/funnel-header/funnel-header";
|
||||||
import insuranceNavBar from "@/fmg-components/insurance-nav-bar/insurance-nav-bar";
|
import navbar from "@/fmg-components/nav-bar/nav-bar";
|
||||||
import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header";
|
import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header";
|
||||||
|
import saveProgressModalQuestion from "@/fmg-components/save-progress-modal-question/save-progress-modal-question";
|
||||||
import { Form } from "vee-validate";
|
import { Form } from "vee-validate";
|
||||||
|
|
||||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import { debugLog } from "@/helpers/debug-log-helper";
|
import { debugLog } from "@/helpers/debug-log-helper";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "recalibration-info",
|
name: "recalibration-info",
|
||||||
mixins: [],
|
mixins: [],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
clientConfig: {},
|
clientConfig: {},
|
||||||
|
recalibrationInfoDesktopImage: "",
|
||||||
|
recalibrationInfoMobileImage: "",
|
||||||
|
adasBodyText: "",
|
||||||
|
showSaveProgressModal: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
Form,
|
Form,
|
||||||
funnelHeader,
|
funnelHeader,
|
||||||
insuranceNavBar,
|
navbar,
|
||||||
funnelSubHeader,
|
funnelSubHeader,
|
||||||
|
saveProgressModalQuestion,
|
||||||
},
|
},
|
||||||
// Ensure CMS content is fetched during route navigation without depending on `to`/`from`
|
// Ensure CMS content is fetched during route navigation without depending on `to`/`from`
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, from, next) {
|
||||||
|
|
@ -66,9 +92,15 @@ export default {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
const emailFromStore = store.getters.order.customer.emailAddress;
|
||||||
|
const showSaveProgressModal = !(emailFromStore?.length > 0);
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.clientConfig = resultMap.clientConfig;
|
vm.clientConfig = resultMap.clientConfig;
|
||||||
|
vm.showSaveProgressModal = showSaveProgressModal;
|
||||||
|
vm.recalibrationInfoDesktopImage = vm.getCmsContent("AdasInfoDesktopWidget", "Image");
|
||||||
|
vm.recalibrationInfoMobileImage = vm.getCmsContent("AdasInfoMobileWidget", "Image");
|
||||||
|
vm.adasBodyText = vm.getCmsContent("AdasInfoDesktopWidget", "BodyText");
|
||||||
debugLog(
|
debugLog(
|
||||||
`recalibration-info clientConfig::${clientConfigPageName}`,
|
`recalibration-info clientConfig::${clientConfigPageName}`,
|
||||||
JSON.stringify(vm.clientConfig)
|
JSON.stringify(vm.clientConfig)
|
||||||
|
|
@ -83,12 +115,6 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
cancelButtonAction() {
|
|
||||||
this.$router.navigateWithoutSaving(
|
|
||||||
this.navigationScenarios.CLICKED_CANCEL_VERIFICATION,
|
|
||||||
this.pageName
|
|
||||||
);
|
|
||||||
},
|
|
||||||
backButtonAction() {
|
backButtonAction() {
|
||||||
this.$router.navigateWithoutSaving(
|
this.$router.navigateWithoutSaving(
|
||||||
this.navigationScenarios.CLICKED_BACK,
|
this.navigationScenarios.CLICKED_BACK,
|
||||||
|
|
@ -107,3 +133,22 @@ export default {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
// Both images are rendered; CSS swaps them at the md breakpoint so no JS
|
||||||
|
// resize listeners are needed.
|
||||||
|
.recal-image--desktop {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.recal-image--mobile {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
@include media-breakpoint-up(md) {
|
||||||
|
.recal-image--desktop {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.recal-image--mobile {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue