diff --git a/jest.config.js b/jest.config.js index 7a8b2eb2b..3e5462315 100644 --- a/jest.config.js +++ b/jest.config.js @@ -26,6 +26,7 @@ module.exports = { "!src/layouts/payment-pia-return/*.vue", // Temp test exclusion while in development "!src/layouts/insurance/*.vue", // Temp test exclusion while in development "!src/layouts/insurance-company/*.vue", // Temp test exclusion while in development + "!src/layouts/insurance-company/insurance-company-question/*.vue", // Temp test exclusion while in development // END ], // ! means exclude from coverage. testMatch: ["**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"], diff --git a/src/layouts/insurance-company/insurance-company-question.spec.js b/src/layouts/insurance-company/insurance-company-question.spec.js new file mode 100644 index 000000000..f79d22cae --- /dev/null +++ b/src/layouts/insurance-company/insurance-company-question.spec.js @@ -0,0 +1,3 @@ +describe("insurance-company-question.vue", () => { + it.todo("Some test for the future"); +}); diff --git a/src/layouts/insurance-company/insurance-company-question.vue b/src/layouts/insurance-company/insurance-company-question.vue new file mode 100644 index 000000000..b69a77d49 --- /dev/null +++ b/src/layouts/insurance-company/insurance-company-question.vue @@ -0,0 +1,191 @@ + + + + + diff --git a/src/layouts/insurance-company/insurance-company-spec.js b/src/layouts/insurance-company/insurance-company-spec.js index e69de29bb..bd932b7d2 100644 --- a/src/layouts/insurance-company/insurance-company-spec.js +++ b/src/layouts/insurance-company/insurance-company-spec.js @@ -0,0 +1,3 @@ +describe("insurance-company.vue", () => { + it.todo("Some test for the future"); +}); diff --git a/src/layouts/insurance-company/insurance-company.vue b/src/layouts/insurance-company/insurance-company.vue index 4fa86743f..7b8310e39 100644 --- a/src/layouts/insurance-company/insurance-company.vue +++ b/src/layouts/insurance-company/insurance-company.vue @@ -10,12 +10,10 @@
- + + { - insuranceCompany.altTerms = ""; - - termMapping.forEach((matchingTerm) => { - if ( - insuranceCompany.accountName - .toUpperCase() - .includes(matchingTerm.term.toUpperCase()) - ) { - insuranceCompany.altTerms = - insuranceCompany.altTerms + matchingTerm.altTerm?.toUpperCase() + " "; - } - }); - - return insuranceCompany; - } - ); - // Call the "next" function to complete the transition to this page. next((vm) => { vm.setCmsContent(resultMap.cmsContent); vm.originalList = resultMap.insuranceCompanyList; - vm.searchableInsuranceCompanyList = searchableInsuranceCompanyList; }); }, data() { return { - searchableInsuranceCompanyList: [], + parentAccountNumber: this.parentAccountNumberFromStore(), originalList: [], - selectedParentAccount: "", }; }, methods: { - arePagePrerequisitesValid() { - return store.getters.vehicle.carId !== null; + parentAccountNumberFromStore() { + return store?.order?.payment?.parentAccountNumber; }, - findMatches(request, response) { - const matches = []; - const term = request?.term?.toUpperCase(); - this.originalList.forEach((company, index) => { - if ( - company.accountName.indexOf(term) !== -1 || - company.altTerms.indexOf(term) !== -1 - ) { - matches.push(company.accountName); - } - }); - response(matches); + arePagePrerequisitesValid() { + return store.getters.order.payment.isInsurance === true; }, backButtonAction() { // Go back to Quote page @@ -149,112 +99,23 @@ export default { await this.dispatchStoreAction( this.storeActions.SAVE_PARENT_ACCOUNT_NUMBER, - this.selectedParentAccount, + this.parentAccountNumber, false ); - navigateToHeritageFunnel({ shouldSaveSession: true, pageNameToLog: "insurance-company", loadingModal: this.$refs.loadingModal, }); }, - selectParentAccountNumber(parentAccountName) { - if (!this.searchableInsuranceCompanyList) { - console.error("No insurance companies found"); - return; - } - - var selectedItem = this.searchableInsuranceCompanyList.filter((item) => { - return item.accountName === parentAccountName; - }); - - if (selectedItem) { - this.selectedParentAccount = selectedItem[0].parentAccountNumber; - } else { - console.error("Error locating " + parentAccountName); - } - }, - }, - mounted() { - const select = this.selectParentAccountNumber; - setTimeout(() => { - $("#autocomplete").autocomplete({ - source: this.findMatches, - position: { - my: "left top+6", - }, - minLength: 0, // Necessary to display menu when clearing input - - // Bold matching letters as you type in the input - search: function (event, ui) { - setTimeout(() => { - let w = $(this).autocomplete("widget").find("div"); - let regExpString = "(" + this.value + ")"; - let re = new RegExp(regExpString, "i"); - w.html((i, html) => - html.replace(re, "$1") - ); - }, 5); - }, - select: function (event, ui) { - select(ui.item.value); - }, - }); - }, 0); }, components: { funnelHeader, navbar, funnelSubHeader, - textboxQuestion, Form, loadingModal, + insuranceCompanyQuestion, }, }; -