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