test: add else case for listenToEscape call spec

pull/3910/head
Arman Ozak 5 years ago
parent 04209199f6
commit 72e8a686f6

@ -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