From 616dc15eb6c9df1f3c7b325190727b83e8a95c69 Mon Sep 17 00:00:00 2001 From: Rohit Sharma Date: Tue, 7 Jul 2020 17:11:12 +0530 Subject: [PATCH] Check for clearTimeout to have been called --- js/tests/unit/toast.spec.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/tests/unit/toast.spec.js b/js/tests/unit/toast.spec.js index 5470d52e6fad..031c841afa08 100644 --- a/js/tests/unit/toast.spec.js +++ b/js/tests/unit/toast.spec.js @@ -186,12 +186,15 @@ describe('Toast', () => { setTimeout(() => { toast._config.autohide = false toastEl.addEventListener('shown.bs.toast', () => { + expect(toast._clearTimeout).toHaveBeenCalled() expect(toast._timeout).toBeNull() done() }) toast.show() }, toast._config.delay / 2) + spyOn(toast, '_clearTimeout').and.callThrough() + toast.show() }) })