From 86da318c280ec6dc10260c411352086fc87515de Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Thu, 23 May 2019 22:12:21 +0200 Subject: [PATCH] test: fix flaky slide-toggle test with pending timer task One of the slide-toggle tests has become quite flaky the last days and after debugging ZoneJS it turns out that this is related to the `(focus)` event from the `FocusMonitor` and we can safely improve the stability of the test by removing the `fakeAsync` which isn't needed anyway. For reference: Other tests asserting the `click` event on the slide-toggle native element also have a `tick()` specified but we don't need to wait for pending timers anyway.. so we can just remove `fakeAsync . --- src/material/slide-toggle/slide-toggle.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/material/slide-toggle/slide-toggle.spec.ts b/src/material/slide-toggle/slide-toggle.spec.ts index 4d6e881aed6..5038654b72b 100644 --- a/src/material/slide-toggle/slide-toggle.spec.ts +++ b/src/material/slide-toggle/slide-toggle.spec.ts @@ -389,7 +389,7 @@ describe('MatSlideToggle without forms', () => { }); describe('custom action configuration', () => { - it('should not change value on click when click action is noop', fakeAsync(() => { + it('should not change value on click when click action is noop', () => { TestBed .resetTestingModule() .configureTestingModule({ @@ -430,7 +430,7 @@ describe('MatSlideToggle without forms', () => { expect(slideToggle.checked).toBe(false, 'Expect slide toggle value not changed'); expect(testComponent.toggleTriggered).toBe(2, 'Expect toggle twice'); expect(testComponent.dragTriggered).toBe(0); - })); + }); it('should not change value on dragging when drag action is noop', fakeAsync(() => { TestBed