CSR-1012 unit test and cms prop updates
This commit is contained in:
parent
c344cf8658
commit
80719416a0
6 changed files with 12 additions and 34 deletions
|
|
@ -196,5 +196,4 @@ describe("modal.vue", () => {
|
|||
// Assert
|
||||
expect(hideMock).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ describe("modal.vue", () => {
|
|||
const wrapper = shallowMount(TextBlock, {
|
||||
mixins: [mockMixin],
|
||||
props: {
|
||||
customText: "customText"
|
||||
}
|
||||
customText: "customText",
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.html()).toEqual(expect.stringContaining("customText"));
|
||||
|
|
@ -48,7 +48,6 @@ describe("modal.vue", () => {
|
|||
});
|
||||
expect(wrapper.html()).toEqual(expect.stringContaining(mockProps["fontWeight"]));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
///////////////
|
||||
|
|
|
|||
|
|
@ -8,9 +8,7 @@
|
|||
v-model="serviceZipCodeQuestion"
|
||||
@service-zip-updated="resetMobileLocation"
|
||||
linkWidgetName="ServiceZipLinkWidget"
|
||||
modalWidgetName="ServiceZipModalWidget"
|
||||
textboxQuestionWidgetName="ServiceZipQuestionWidget"
|
||||
alertInvalidZipWidgetName="AlertInvalidZipWidget" />
|
||||
modalWidgetName="ServiceZipModalWidget" />
|
||||
<mobileLocationModalQuestions
|
||||
v-model="mobileLocationQuestions"
|
||||
ref="mobileLocationModalQuestions"
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ jest.mock("@/digital-components/modal/modal", () => ({
|
|||
|
||||
const linkWidgetName = "linkWidgetName";
|
||||
const modalWidgetName = "modalWidgetName";
|
||||
const textboxQuestionWidgetName = "textboxQuestionWidgetName";
|
||||
|
||||
const mockLinkCmsContent = {
|
||||
BodyText: "Sample link body text here.",
|
||||
|
|
@ -27,10 +26,6 @@ const mockModalCmsContent = {
|
|||
FooterText: "Sample modal footer text here.",
|
||||
};
|
||||
|
||||
const mockTextboxQuestionCmsContent = {
|
||||
QuestionText: "Sample question text here.",
|
||||
};
|
||||
|
||||
const mockMixin = {
|
||||
methods: {
|
||||
getCmsContent: jest.fn((widgetName, cmsFieldName) => {
|
||||
|
|
@ -42,10 +37,6 @@ const mockMixin = {
|
|||
return mockModalCmsContent[cmsFieldName];
|
||||
}
|
||||
|
||||
if (widgetName === textboxQuestionWidgetName) {
|
||||
return mockTextboxQuestionCmsContent[cmsFieldName];
|
||||
}
|
||||
|
||||
return null;
|
||||
}),
|
||||
|
||||
|
|
@ -96,7 +87,6 @@ describe("service-zip-modal-question.vue", () => {
|
|||
modelValue: serviceZipCodeQuestion,
|
||||
linkWidgetName: linkWidgetName,
|
||||
modalWidgetName: modalWidgetName,
|
||||
textboxQuestionWidgetName: textboxQuestionWidgetName,
|
||||
},
|
||||
attachTo: document.body,
|
||||
});
|
||||
|
|
@ -119,7 +109,6 @@ describe("service-zip-modal-question.vue", () => {
|
|||
modelValue: serviceZipCodeQuestion,
|
||||
linkWidgetName: linkWidgetName,
|
||||
modalWidgetName: modalWidgetName,
|
||||
textboxQuestionWidgetName: textboxQuestionWidgetName,
|
||||
},
|
||||
attachTo: document.body,
|
||||
});
|
||||
|
|
@ -144,7 +133,6 @@ describe("service-zip-modal-question.vue", () => {
|
|||
modelValue: serviceZipCodeQuestion,
|
||||
linkWidgetName: linkWidgetName,
|
||||
modalWidgetName: modalWidgetName,
|
||||
textboxQuestionWidgetName: textboxQuestionWidgetName,
|
||||
},
|
||||
attachTo: document.body,
|
||||
});
|
||||
|
|
@ -175,7 +163,6 @@ describe("service-zip-modal-question.vue", () => {
|
|||
modelValue: serviceZipCodeQuestion,
|
||||
linkWidgetName: linkWidgetName,
|
||||
modalWidgetName: modalWidgetName,
|
||||
textboxQuestionWidgetName: textboxQuestionWidgetName,
|
||||
},
|
||||
attachTo: document.body,
|
||||
});
|
||||
|
|
@ -204,7 +191,6 @@ describe("service-zip-modal-question.vue", () => {
|
|||
modelValue: serviceZipCodeQuestion,
|
||||
linkWidgetName: linkWidgetName,
|
||||
modalWidgetName: modalWidgetName,
|
||||
textboxQuestionWidgetName: textboxQuestionWidgetName,
|
||||
},
|
||||
attachTo: document.body,
|
||||
});
|
||||
|
|
@ -233,7 +219,6 @@ describe("service-zip-modal-question.vue", () => {
|
|||
modelValue: serviceZipCodeQuestion,
|
||||
linkWidgetName: linkWidgetName,
|
||||
modalWidgetName: modalWidgetName,
|
||||
textboxQuestionWidgetName: textboxQuestionWidgetName,
|
||||
},
|
||||
attachTo: document.body,
|
||||
});
|
||||
|
|
@ -262,7 +247,6 @@ describe("service-zip-modal-question.vue", () => {
|
|||
modelValue: serviceZipCodeQuestion,
|
||||
linkWidgetName: linkWidgetName,
|
||||
modalWidgetName: modalWidgetName,
|
||||
textboxQuestionWidgetName: textboxQuestionWidgetName,
|
||||
},
|
||||
attachTo: document.body,
|
||||
});
|
||||
|
|
@ -291,7 +275,6 @@ describe("service-zip-modal-question.vue", () => {
|
|||
modelValue: serviceZipCodeQuestion,
|
||||
linkWidgetName: linkWidgetName,
|
||||
modalWidgetName: modalWidgetName,
|
||||
textboxQuestionWidgetName: textboxQuestionWidgetName,
|
||||
},
|
||||
attachTo: document.body,
|
||||
});
|
||||
|
|
@ -321,7 +304,6 @@ describe("service-zip-modal-question.vue", () => {
|
|||
modelValue: serviceZipCodeQuestion,
|
||||
linkWidgetName: linkWidgetName,
|
||||
modalWidgetName: modalWidgetName,
|
||||
textboxQuestionWidgetName: textboxQuestionWidgetName,
|
||||
},
|
||||
attachTo: document.body,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -59,10 +59,14 @@ export default {
|
|||
},
|
||||
linkWidgetName: String,
|
||||
modalWidgetName: String,
|
||||
textboxQuestionWidgetName: String,
|
||||
alertInvalidZipWidgetName: String,
|
||||
},
|
||||
computed: {
|
||||
textboxQuestionWidgetName() {
|
||||
return "ServiceZipQuestionWidget";
|
||||
},
|
||||
alertInvalidZipWidgetName() {
|
||||
return "AlertInvalidZipWidget";
|
||||
},
|
||||
serviceZipLinkText() {
|
||||
if (this.modelValue.zipCode && this.modelValue.zipCode.length > 0) {
|
||||
return this.modelValue.state + ", " + this.modelValue.zipCode;
|
||||
|
|
@ -111,9 +115,6 @@ export default {
|
|||
|
||||
onInputIdAssigned(inputId) {
|
||||
this.serviceZipCodeTextInputId = inputId;
|
||||
|
||||
// bubble up the event to the parent
|
||||
this.$emit("textboxQuestionEvent.inputIdAssigned", inputId);
|
||||
},
|
||||
|
||||
onModalOpened() {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ describe("service-zip-question.vue", () => {
|
|||
|
||||
// Act
|
||||
const modelValueText = wrapper.vm.value;
|
||||
wrapper.vm.value = "test also"
|
||||
wrapper.vm.value = "test also";
|
||||
|
||||
// Assert
|
||||
expect(modelValueText).toEqual("test");
|
||||
|
|
@ -32,10 +32,9 @@ describe("service-zip-question.vue", () => {
|
|||
|
||||
// Act
|
||||
const modelValueText = wrapper.vm.value;
|
||||
wrapper.vm.value = "test also"
|
||||
wrapper.vm.value = "test also";
|
||||
|
||||
// Assert
|
||||
expect(wrapper.emitted("update:modelValue")).toEqual([["test also"]]);
|
||||
})
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue