Merge pull request #713 from Safelite/feature/CSR-795
CSR-795 | Refactor modal etc.
This commit is contained in:
commit
e5257d555c
2 changed files with 62 additions and 2 deletions
61
src/common-components/modal/modal.spec.js
Normal file
61
src/common-components/modal/modal.spec.js
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
import { shallowMount } from "@vue/test-utils";
|
||||
import Modal from "./modal";
|
||||
|
||||
|
||||
describe("modal.vue", () => {
|
||||
it("Should display header text when HeaderText is defined in the CMS", async () => {
|
||||
// Act
|
||||
const wrapper = shallowMount(Modal, {
|
||||
mixins: [mockMixin]
|
||||
});
|
||||
expect(wrapper.html()).toEqual(expect.stringContaining(mockCmsContent['HeaderText']));
|
||||
});
|
||||
|
||||
it("Should display subheader text when SubheaderText is defined in the CMS", async () => {
|
||||
// Act
|
||||
const wrapper = shallowMount(Modal, {
|
||||
mixins: [mockMixin]
|
||||
});
|
||||
expect(wrapper.html()).toEqual(expect.stringContaining(mockCmsContent['SubheaderText']));
|
||||
});
|
||||
|
||||
it("Should insert image url when Image is defined in the CMS", async () => {
|
||||
// Act
|
||||
const wrapper = shallowMount(Modal, {
|
||||
mixins: [mockMixin]
|
||||
});
|
||||
expect(wrapper.html()).toEqual(expect.stringContaining(mockCmsContent['Image']));
|
||||
});
|
||||
|
||||
it("Should display body text when BodyText is defined in the CMS", async () => {
|
||||
// Act
|
||||
const wrapper = shallowMount(Modal, {
|
||||
mixins: [mockMixin]
|
||||
});
|
||||
expect(wrapper.html()).toEqual(expect.stringContaining(mockCmsContent['BodyText']));
|
||||
});
|
||||
|
||||
it("Should display footer text when FooterText is defined in the CMS", async () => {
|
||||
// Act
|
||||
const wrapper = shallowMount(Modal, {
|
||||
mixins: [mockMixin]
|
||||
});
|
||||
expect(wrapper.html()).toEqual(expect.stringContaining(mockCmsContent['FooterText']));
|
||||
});
|
||||
});
|
||||
|
||||
const mockMixin = {
|
||||
methods: {
|
||||
getCmsContent: jest.fn((widgetName, cmsFieldName) => {
|
||||
return mockCmsContent[cmsFieldName];
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const mockCmsContent = {
|
||||
'HeaderText': "Sample header text here.",
|
||||
'SubheaderText': "Sample subheader text here.",
|
||||
'Image': "https://www.sampleImage.sample",
|
||||
'BodyText': "Sample body text here.",
|
||||
'FooterText': "Sample footer text here.",
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
<div class="modal-body px-4 py-5">
|
||||
<img :src="this.ModalImage" class="w-100 mb-4" alt="" />
|
||||
<h5 class="mb-4" v-html="this.ModalHeadline"></h5>
|
||||
<p class="fw-bold mb-2" v-html="this.ModalSubheaderText"></p>
|
||||
<p class="fw-bold mb-2" v-html="this.ModalSubheadertext"></p>
|
||||
<p class="mb-0" v-html="this.ModalBodyText"></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
|
@ -18,7 +18,6 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import textLink from "@/ux-components/text-link/text-link";
|
||||
export default {
|
||||
name: 'modal',
|
||||
props: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue