diff --git a/src/iss-components/vehicle-banner/vehicle-banner.vue b/src/iss-components/vehicle-banner/vehicle-banner.vue index fe0737f9..568313dc 100644 --- a/src/iss-components/vehicle-banner/vehicle-banner.vue +++ b/src/iss-components/vehicle-banner/vehicle-banner.vue @@ -66,6 +66,9 @@ export default { default: return this.carUnmatchedVehicleIcon; } + }, + forceRerender() { + this.componentKey += 1; } } }; diff --git a/src/layouts/entry-page/entry-page.spec.js b/src/layouts/entry-page/entry-page.spec.js new file mode 100644 index 00000000..0b189c8d --- /dev/null +++ b/src/layouts/entry-page/entry-page.spec.js @@ -0,0 +1,54 @@ +// Components +import entryPage from "@/layouts/entry-page/entry-page.vue"; + +import { shallowMount } from '@vue/test-utils'; +import { settleAllPromises } from "@/helpers/layout-helper.js"; +import { fetchCmsContentForPage, setupModalLinks } from "@/helpers/cms-content-helper"; +import { getMountOptions } from "@/helpers/unit-test-helper.js"; +import { useMainStore } from "@/store"; + +// Mock our module for promises. +jest.mock("@/helpers/layout-helper.js", () => ({ + settleAllPromises: jest.fn(), +})); + +// Mock fetchCmsContentForPage +jest.mock("@/helpers/cms-content-helper", () => ({ + fetchCmsContentForPage: jest.fn(), + setupModalLinks: jest.fn(), +})); + +describe('entry-page.vue', () => { + test('should render', () => { + + const queryString = 'policynumber="123456"' + const { wrapper } = setupMocks(queryString); + + console.log(wrapper.vm.$route.query); + expect(wrapper).toBeTruthy(); + }) + +}); + +function setupMocks(queryString) { + const mountOptions = getMountOptions({ + router: { + navigate: jest.fn(), + }, + route: { queryString } + }); + + const wrapper = shallowMount( + entryPage, + mountOptions + ); + + const apiResponses = {}; + + settleAllPromises.mockImplementation(() => apiResponses); + fetchCmsContentForPage.mockImplementation (() => {}); + + + return { wrapper }; +}; + diff --git a/src/layouts/vehicle-selection/vehicle-question/vehicle-question.vue b/src/layouts/vehicle-selection/vehicle-question/vehicle-question.vue index 68143c8d..5341a18c 100644 --- a/src/layouts/vehicle-selection/vehicle-question/vehicle-question.vue +++ b/src/layouts/vehicle-selection/vehicle-question/vehicle-question.vue @@ -1,9 +1,10 @@ @@ -16,30 +17,26 @@ export default { data() { return { values: [], + selectedIndex: null, }; }, + props: { modelValue: String, updateValues: Function, }, components: { - dropdownQuestion -}, + dropdownQuestion + }, computed: { selectedValue: { - get: function() { - return this.modelValue?.toString(); + get() { + return this.selectedIndex?.toString(); }, - set: function(newValue) { - if(newValue) - { - const val = this.values[newValue] - this.$emit("update:modelValue", val); - } - else - { - this.$emit("update:modelValue", null); - } + set(newValue) { + this.selectedIndex = newValue; + newValue = newValue ? this.values[newValue] : null; + this.$emit("update:modelValue", newValue); } }, }, diff --git a/src/layouts/vehicle-selection/vehicle-selection.vue b/src/layouts/vehicle-selection/vehicle-selection.vue index f41e5d28..2a8729dd 100644 --- a/src/layouts/vehicle-selection/vehicle-selection.vue +++ b/src/layouts/vehicle-selection/vehicle-selection.vue @@ -1,5 +1,5 @@