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