SSR-365
Steering text to appear for state MA
This commit is contained in:
parent
75d0a97965
commit
307e7d2fbb
3 changed files with 88 additions and 3 deletions
45
src/iss-components/steering-text/steering-text.spec.js
Normal file
45
src/iss-components/steering-text/steering-text.spec.js
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import { shallowMount } from "@vue/test-utils";
|
||||
import steeringTextModal from "./steering-text";
|
||||
import { createApp } from 'vue';
|
||||
import { createPinia } from "pinia";
|
||||
import App from '@/App.vue';
|
||||
|
||||
describe("steering-text.vue", () => {
|
||||
test("Should display steering text from CMS for state MA", async () => {
|
||||
// Act
|
||||
|
||||
const wrapper = shallowMount(steeringTextModal, {
|
||||
mixins: [mockMixin],
|
||||
props: {
|
||||
cmsWidgetName: "MASteeringTextWidget",
|
||||
},
|
||||
attachTo: document.body,
|
||||
});
|
||||
expect(wrapper.html()).toEqual(expect.stringContaining(mockCmsContent["BodyText"]));
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
const vueApp = createApp(App);
|
||||
const pinia = createPinia();
|
||||
vueApp.use(pinia);
|
||||
///////////////
|
||||
// Constants //
|
||||
///////////////
|
||||
|
||||
const mockMixin = {
|
||||
methods: {
|
||||
getCmsContent: jest.fn((widgetName, cmsFieldName) => {
|
||||
return mockCmsContent[cmsFieldName];
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
const mockCmsContent = {
|
||||
BodyText: "MASteeringText",
|
||||
|
||||
};
|
||||
|
||||
|
||||
37
src/iss-components/steering-text/steering-text.vue
Normal file
37
src/iss-components/steering-text/steering-text.vue
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<template>
|
||||
<div>
|
||||
<textBlock
|
||||
cmsWidgetName="MASteeringText"
|
||||
id="SteeringTextContent"
|
||||
/>
|
||||
<div>
|
||||
<p class="small" v-if="isStateMA" v-html="MASteeringText" ></p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { useMainStore } from "@/store";
|
||||
|
||||
export default{
|
||||
name: "steeringTextModal",
|
||||
computed: {
|
||||
MASteeringText() {
|
||||
return this.getCmsContent("MASteeringText", "BodyText");
|
||||
},
|
||||
isStateMA()
|
||||
{
|
||||
if (this.mainStore.order.customer.address.state=='MA')
|
||||
{
|
||||
return true
|
||||
}
|
||||
}
|
||||
},
|
||||
setup() {
|
||||
const mainStore = useMainStore();
|
||||
return { mainStore };
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -34,6 +34,7 @@
|
|||
</p>
|
||||
</div>
|
||||
<recalModal cmsWidgetName="RecalModal" />
|
||||
<SteeringText cmsWidgetName="MASteeringText" ></SteeringText>
|
||||
<siteFooter
|
||||
cmsWidgetName="SiteFooterWidget"
|
||||
:isForwardActionDisabled="!meta.valid"
|
||||
|
|
@ -55,13 +56,14 @@ import siteHeader from '@/iss-components/site-header/site-header.vue';
|
|||
import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header.vue';
|
||||
import textBlock from "@/digital-components/text-block/text-block";
|
||||
import recalModal from '@/layouts/coverage-statement/recal-modal/recal-modal.vue';
|
||||
|
||||
import steeringText from "@/iss-components/steering-text/steering-text";
|
||||
// Import Supporting Files
|
||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||
import { settleAllPromises } from '@/helpers/layout-helper';
|
||||
import { getDamageString } from '@/helpers/damage-helper.js';
|
||||
import { useMainStore } from "@/store";
|
||||
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
||||
import SteeringText from '../../iss-components/steering-text/steering-text.vue';
|
||||
|
||||
export default {
|
||||
name: 'coverage-statement',
|
||||
|
|
@ -72,8 +74,9 @@ export default {
|
|||
siteSubHeader,
|
||||
Form,
|
||||
textBlock,
|
||||
recalModal
|
||||
},
|
||||
recalModal,
|
||||
SteeringText
|
||||
},
|
||||
computed: {
|
||||
bodyText() {
|
||||
if (useMainStore().order.damage.isRepair) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue