Merge pull request #1537 from Safelite/feature/CSR-1393.1
focus on input
This commit is contained in:
commit
44339314bf
3 changed files with 6 additions and 14 deletions
|
|
@ -33,7 +33,6 @@
|
||||||
class="pb-2"
|
class="pb-2"
|
||||||
v-model="lineItems"
|
v-model="lineItems"
|
||||||
:availableVaps="availableVaps"
|
:availableVaps="availableVaps"
|
||||||
linkWidgetName="PromoLinkWidget"
|
|
||||||
modalWidgetName="PromoModalWidget" />
|
modalWidgetName="PromoModalWidget" />
|
||||||
|
|
||||||
<hr class="mb-5" />
|
<hr class="mb-5" />
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,8 @@ jest.mock("@/digital-components/modal/modal", () => ({
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const linkWidgetName = "linkWidgetName";
|
|
||||||
const modalWidgetName = "modalWidgetName";
|
const modalWidgetName = "modalWidgetName";
|
||||||
|
|
||||||
const mockLinkCmsContent = {
|
|
||||||
BodyText: "Sample link body text here.",
|
|
||||||
};
|
|
||||||
|
|
||||||
const mockModalCmsContent = {
|
const mockModalCmsContent = {
|
||||||
FooterText: "Sample modal footer text here.",
|
FooterText: "Sample modal footer text here.",
|
||||||
};
|
};
|
||||||
|
|
@ -28,10 +23,6 @@ const mockModalCmsContent = {
|
||||||
const mockMixin = {
|
const mockMixin = {
|
||||||
methods: {
|
methods: {
|
||||||
getCmsContent: jest.fn((widgetName, cmsFieldName) => {
|
getCmsContent: jest.fn((widgetName, cmsFieldName) => {
|
||||||
if (widgetName === linkWidgetName) {
|
|
||||||
return mockLinkCmsContent[cmsFieldName];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (widgetName === modalWidgetName) {
|
if (widgetName === modalWidgetName) {
|
||||||
return mockModalCmsContent[cmsFieldName];
|
return mockModalCmsContent[cmsFieldName];
|
||||||
}
|
}
|
||||||
|
|
@ -48,7 +39,6 @@ describe("promo-modal-question.vue", () => {
|
||||||
const wrapper = mount(promoModalQuestion, {
|
const wrapper = mount(promoModalQuestion, {
|
||||||
mixins: [mockMixin],
|
mixins: [mockMixin],
|
||||||
props: {
|
props: {
|
||||||
linkWidgetName: linkWidgetName,
|
|
||||||
modalWidgetName: modalWidgetName,
|
modalWidgetName: modalWidgetName,
|
||||||
},
|
},
|
||||||
attachTo: document.body,
|
attachTo: document.body,
|
||||||
|
|
@ -74,7 +64,6 @@ describe("promo-modal-question.vue", () => {
|
||||||
mixins: [mockMixin],
|
mixins: [mockMixin],
|
||||||
props: {
|
props: {
|
||||||
modelValue: lineItems,
|
modelValue: lineItems,
|
||||||
linkWidgetName: linkWidgetName,
|
|
||||||
modalWidgetName: modalWidgetName,
|
modalWidgetName: modalWidgetName,
|
||||||
},
|
},
|
||||||
attachTo: document.body,
|
attachTo: document.body,
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,14 @@
|
||||||
:ref="modalName"
|
:ref="modalName"
|
||||||
:headerText="modalHeaderText"
|
:headerText="modalHeaderText"
|
||||||
:onModalClosedCallback="onModalClosed"
|
:onModalClosedCallback="onModalClosed"
|
||||||
|
:onModalOpenedCallback="focusOnPromoInput"
|
||||||
:footerButtonText="modalFooterText"
|
:footerButtonText="modalFooterText"
|
||||||
@footer-button-event="addPromoCode">
|
@footer-button-event="addPromoCode">
|
||||||
<promoQuestion
|
<promoQuestion
|
||||||
ref="promoQuestion"
|
ref="promoQuestion"
|
||||||
customInputId="promoCode"
|
customInputId="promoCode"
|
||||||
v-model="promoCode"
|
v-model="promoCode"
|
||||||
|
v-on="{ 'textboxQuestionEvent.inputIdAssigned': onInputIdAssigned }"
|
||||||
cmsWidgetName="PromoQuestionWidget" />
|
cmsWidgetName="PromoQuestionWidget" />
|
||||||
<alert
|
<alert
|
||||||
ref="alertInvalidPromo"
|
ref="alertInvalidPromo"
|
||||||
|
|
@ -74,13 +76,12 @@ export default {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
modelValue: Object,
|
modelValue: Object,
|
||||||
linkWidgetName: String,
|
|
||||||
modalWidgetName: String,
|
modalWidgetName: String,
|
||||||
availableVaps: Object,
|
availableVaps: Object,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
promoLinkText() {
|
promoLinkText() {
|
||||||
return this.getCmsContent(this.linkWidgetName, "BodyText");
|
return this.getCmsContent(this.modalWidgetName, "HeaderText");
|
||||||
},
|
},
|
||||||
modalHeaderText() {
|
modalHeaderText() {
|
||||||
return this.getCmsContent("PromoQuestionWidget", "QuestionText");
|
return this.getCmsContent("PromoQuestionWidget", "QuestionText");
|
||||||
|
|
@ -127,6 +128,9 @@ export default {
|
||||||
getPromoCode() {
|
getPromoCode() {
|
||||||
return this.lineItems.promos?.[0].promoCode;
|
return this.lineItems.promos?.[0].promoCode;
|
||||||
},
|
},
|
||||||
|
onInputIdAssigned(inputId) {
|
||||||
|
this.promoTextInputId = inputId;
|
||||||
|
},
|
||||||
openModal() {
|
openModal() {
|
||||||
this.modal.openModal();
|
this.modal.openModal();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue