Browse Source

test: add else case for listenToEscape call spec

pull/3910/head
Arman Ozak 6 years ago
parent
commit
72e8a686f6
  1. 21
      npm/ng-packs/packages/theme-shared/src/lib/tests/confirmation.service.spec.ts

21
npm/ng-packs/packages/theme-shared/src/lib/tests/confirmation.service.spec.ts

@ -106,13 +106,20 @@ describe('ConfirmationService', () => {
selectConfirmationElement<HTMLButtonElement>('button#cancel').click();
});
test('should not call the listenToEscape method when dismissible is false', () => {
const spy = spyOn(service as any, 'listenToEscape');
service.info('', '', { dismissible: false });
expect(spy.calls.count()).toBe(0);
});
test.each`
dismissible | count
${true} | ${1}
${false} | ${0}
`(
'should call the listenToEscape method $count times when dismissible is $dismissible',
({ dismissible, count }) => {
const spy = spyOn(service as any, 'listenToEscape');
service.info('', '', { dismissible });
expect(spy).toHaveBeenCalledTimes(count);
},
);
});
function clearElements(selector = '.confirmation') {

Loading…
Cancel
Save