Merge pull request #842 from Safelite/feature/richardson/SSR-1466
Unit tests for emits
This commit is contained in:
commit
0711143f49
3 changed files with 39 additions and 3 deletions
|
|
@ -86,3 +86,31 @@ describe('Computed', () => {
|
|||
expect(modalHeader).toBe(mockDataStrings.cmsHeaderText);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Emits', () => {
|
||||
test('Should emit cancel-claim-confirmation when method called', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks();
|
||||
|
||||
// Act
|
||||
wrapper.vm.cancelClaimConfirmation();
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.emitted('cancel-claim-confirmation')).toBeTruthy();
|
||||
expect(wrapper.emitted('cancel-claim-confirmation').length).toBe(1);
|
||||
});
|
||||
|
||||
test('Should emit return-to-claim when method called', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks();
|
||||
|
||||
// Act
|
||||
wrapper.vm.returnToClaim();
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.emitted('return-to-claim')).toBeTruthy();
|
||||
expect(wrapper.emitted('return-to-claim').length).toBe(1);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable max-len */
|
||||
// Components
|
||||
import coverageStatement from '@/layouts/coverage-statement/coverage-statement.vue';
|
||||
|
||||
|
|
@ -93,6 +94,8 @@ function getMountedComponent(mainInitialState = {}, initialData = {}, methodToRu
|
|||
|
||||
const wrapper = shallowMount(coverageStatement, mountOptions);
|
||||
wrapper.vm.$refs[CANCEL_CLAIM_REF_NAME].openModal = jest.fn();
|
||||
wrapper.vm.$refs.siteFooter.disableForwardButton = jest.fn();
|
||||
wrapper.vm.$refs.siteFooter.enableForwardAction = jest.fn();
|
||||
return { wrapper };
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -346,9 +346,14 @@ export default {
|
|||
},
|
||||
watch: {
|
||||
selectedProvider() {
|
||||
if (this.selectedProvider && this.selectedProvider !== SAFELITE_PROVIDER) {
|
||||
this.$refs[this.CANCEL_CLAIM_REF_NAME].openModal();
|
||||
this.selectedProvider = '';
|
||||
if (this.selectedProvider) {
|
||||
if (this.selectedProvider !== SAFELITE_PROVIDER) {
|
||||
this.$refs[this.CANCEL_CLAIM_REF_NAME].openModal();
|
||||
this.selectedProvider = '';
|
||||
this.$refs.siteFooter.disableForwardButton();
|
||||
} else {
|
||||
this.$refs.siteFooter.enableForwardAction();
|
||||
}
|
||||
}
|
||||
},
|
||||
nextStepsBody(newValue, oldValue) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue