Skip to content

Commit 86da318

Browse files
devversionmmalerba
authored andcommitted
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 .
1 parent bdc6811 commit 86da318

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/material/slide-toggle/slide-toggle.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ describe('MatSlideToggle without forms', () => {
389389
});
390390

391391
describe('custom action configuration', () => {
392-
it('should not change value on click when click action is noop', fakeAsync(() => {
392+
it('should not change value on click when click action is noop', () => {
393393
TestBed
394394
.resetTestingModule()
395395
.configureTestingModule({
@@ -430,7 +430,7 @@ describe('MatSlideToggle without forms', () => {
430430
expect(slideToggle.checked).toBe(false, 'Expect slide toggle value not changed');
431431
expect(testComponent.toggleTriggered).toBe(2, 'Expect toggle twice');
432432
expect(testComponent.dragTriggered).toBe(0);
433-
}));
433+
});
434434

435435
it('should not change value on dragging when drag action is noop', fakeAsync(() => {
436436
TestBed

0 commit comments

Comments
 (0)