Merge remote-tracking branch 'origin/develop' into feature/digital/SSR-1064
This commit is contained in:
commit
5f6cc8d38f
3 changed files with 44 additions and 25 deletions
|
|
@ -9,7 +9,6 @@ import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
|||
import { mount } from '@vue/test-utils';
|
||||
import { createTestingPinia } from '@pinia/testing';
|
||||
import bailoutMessage from '@/constants/bailoutMessage';
|
||||
// import navigationScenarios from '@/router/router-constants/navigation-scenarios.js';
|
||||
|
||||
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
|
||||
|
||||
|
|
@ -40,7 +39,8 @@ const footerStub = {
|
|||
function getMountedComponent(mainInitialState = {}, initialData = {}, methodToRun = () => {}) {
|
||||
const mountOptions = getMountOptions({
|
||||
router: {
|
||||
navigate: jest.fn()
|
||||
navigate: jest.fn(),
|
||||
navigateToExternalUrl: jest.fn()
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -154,9 +154,15 @@ describe('TPAConfirmation.vue', () => {
|
|||
// Assert
|
||||
expect(deductibleBox.exists()).toBe(true);
|
||||
});
|
||||
test('Should render Site Footer', () => {
|
||||
test('If Advanced flow, should display Site Footer', () => {
|
||||
// Arrange
|
||||
const { wrapper } = getMountedComponent({});
|
||||
const carrierReturnUrl = 'testURL';
|
||||
const initialStore = {
|
||||
issConfig: {
|
||||
successReturnURL: carrierReturnUrl
|
||||
}
|
||||
};
|
||||
const { wrapper } = getMountedComponent(initialStore);
|
||||
|
||||
// Act
|
||||
const siteFooter = wrapper.findComponent({ ref: 'siteFooter' });
|
||||
|
|
@ -164,6 +170,16 @@ describe('TPAConfirmation.vue', () => {
|
|||
// Assert
|
||||
expect(siteFooter.exists()).toBe(true);
|
||||
});
|
||||
test('If Essential flow, should not display Site Footer', () => {
|
||||
// Arrange
|
||||
const { wrapper } = getMountedComponent();
|
||||
|
||||
// Act
|
||||
const siteFooter = wrapper.findComponent({ ref: 'siteFooter' });
|
||||
|
||||
// Assert
|
||||
expect(siteFooter.isVisible()).toBe(false);
|
||||
});
|
||||
});
|
||||
describe('Computed properties', () => {
|
||||
describe('Deductible Box value', () => {
|
||||
|
|
@ -351,19 +367,23 @@ describe('TPAConfirmation.vue', () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
// TODO: Add tests for forward navigation to carrier URL - card SSR-1107
|
||||
describe('Navigation', () => {
|
||||
// test('Forward button action, navigate forward with CLICKED_FORWARD scenario', () => {
|
||||
// // Arrange
|
||||
// const { wrapper } = getMountedComponent({});
|
||||
test('If Advanced flow, forward button action navigates to carrier URL', () => {
|
||||
// Arrange
|
||||
const carrierReturnUrl = 'testURL';
|
||||
const initialStore = {
|
||||
issConfig: {
|
||||
successReturnURL: carrierReturnUrl
|
||||
}
|
||||
};
|
||||
const { wrapper } = getMountedComponent(initialStore);
|
||||
|
||||
// // Act
|
||||
// wrapper.vm.forwardButtonAction();
|
||||
// Act
|
||||
wrapper.vm.forwardButtonAction();
|
||||
|
||||
// // Assert
|
||||
// expect(wrapper.vm.$router.navigate)
|
||||
// .toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD);
|
||||
// });
|
||||
// Assert
|
||||
expect(wrapper.vm.$router.navigateToExternalUrl).toHaveBeenCalledWith(carrierReturnUrl);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@
|
|||
:value="deductibleBoxValue" />
|
||||
</div>
|
||||
<siteFooter
|
||||
v-if="carrierUrl"
|
||||
ref="siteFooter"
|
||||
cmsWidgetName="SiteFooterWidget"
|
||||
:isForwardActionDisabled="!meta.valid"
|
||||
|
|
@ -168,24 +169,18 @@ export default {
|
|||
return this.mainStore.issConfig.clientName;
|
||||
},
|
||||
carrierUrl() {
|
||||
const url = this.mainStore.issConfig.successReturnURL;
|
||||
console.log(url);
|
||||
return url;
|
||||
return this.mainStore.issConfig.successReturnURL;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.siteFooter.updateButtonText(`Go back to ${this.carrierName}`);
|
||||
if (this.carrierUrl) {
|
||||
this.$refs.siteFooter.updateButtonText(`Go back to ${this.carrierName}`);
|
||||
}
|
||||
},
|
||||
methods:
|
||||
{
|
||||
async forwardButtonAction() {
|
||||
window.location.href = this.carrierUrl;
|
||||
},
|
||||
navigateForward() {
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD,
|
||||
this.$route
|
||||
);
|
||||
this.$router.navigateToExternalUrl(this.carrierUrl);
|
||||
},
|
||||
getCustomValueFromString(str) {
|
||||
switch (str) {
|
||||
|
|
|
|||
|
|
@ -182,6 +182,10 @@ router.navigateWithoutSaving = (
|
|||
navigate(scenario, currentRoute, optionalQuery, optionalParams, optionalPageData);
|
||||
};
|
||||
|
||||
router.navigateToExternalUrl = (url, optionalQuery = {}) => {
|
||||
navigateToUrl(url, optionalQuery);
|
||||
};
|
||||
|
||||
// Get route information by page name.
|
||||
// This will reach out to the Cms and there is a 1:1 relationship between page names and route names.
|
||||
async function GetRouteInfoFromPageName(pageName) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue