From 6d1ba7a748d16ed0ea4fd3510f9144eb90f74d58 Mon Sep 17 00:00:00 2001 From: crisbeto Date: Fri, 24 Apr 2020 16:46:32 +0200 Subject: [PATCH] test(material-experimental/mdc-tabs): fix failing tests Recently #16869 was merged which was created before we had MDC-based tabs which means that the MDC tests were never updated. --- .../mdc-tabs/tab-nav-bar/tab-nav-bar.spec.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/material-experimental/mdc-tabs/tab-nav-bar/tab-nav-bar.spec.ts b/src/material-experimental/mdc-tabs/tab-nav-bar/tab-nav-bar.spec.ts index 09ee03dbce92..e7e0e5c3e72a 100644 --- a/src/material-experimental/mdc-tabs/tab-nav-bar/tab-nav-bar.spec.ts +++ b/src/material-experimental/mdc-tabs/tab-nav-bar/tab-nav-bar.spec.ts @@ -147,27 +147,29 @@ describe('MDC-based MatTabNavBar', () => { expect(tabLinkElement.classList).toContain('mat-mdc-tab-disabled'); }); - it('should re-align the ink bar when the direction changes', () => { + it('should re-align the ink bar when the direction changes', fakeAsync(() => { const inkBar = fixture.componentInstance.tabNavBar._inkBar; spyOn(inkBar, 'alignToElement'); dirChange.next(); + tick(); fixture.detectChanges(); expect(inkBar.alignToElement).toHaveBeenCalled(); - }); + })); - it('should re-align the ink bar when the tabs list change', () => { + it('should re-align the ink bar when the tabs list change', fakeAsync(() => { const inkBar = fixture.componentInstance.tabNavBar._inkBar; spyOn(inkBar, 'alignToElement'); fixture.componentInstance.tabs = [1, 2, 3, 4]; fixture.detectChanges(); + tick(); expect(inkBar.alignToElement).toHaveBeenCalled(); - }); + })); it('should re-align the ink bar when the tab labels change the width', done => { const inkBar = fixture.componentInstance.tabNavBar._inkBar;