Skip to content

Commit 4136a70

Browse files
authored
test(material-experimental/mdc-tabs): fix failing tests (#19165)
Recently #16869 was merged which was created before we had MDC-based tabs which means that the MDC tests were never updated.
1 parent 495edca commit 4136a70

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/material-experimental/mdc-tabs/tab-nav-bar/tab-nav-bar.spec.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -147,27 +147,29 @@ describe('MDC-based MatTabNavBar', () => {
147147
expect(tabLinkElement.classList).toContain('mat-mdc-tab-disabled');
148148
});
149149

150-
it('should re-align the ink bar when the direction changes', () => {
150+
it('should re-align the ink bar when the direction changes', fakeAsync(() => {
151151
const inkBar = fixture.componentInstance.tabNavBar._inkBar;
152152

153153
spyOn(inkBar, 'alignToElement');
154154

155155
dirChange.next();
156+
tick();
156157
fixture.detectChanges();
157158

158159
expect(inkBar.alignToElement).toHaveBeenCalled();
159-
});
160+
}));
160161

161-
it('should re-align the ink bar when the tabs list change', () => {
162+
it('should re-align the ink bar when the tabs list change', fakeAsync(() => {
162163
const inkBar = fixture.componentInstance.tabNavBar._inkBar;
163164

164165
spyOn(inkBar, 'alignToElement');
165166

166167
fixture.componentInstance.tabs = [1, 2, 3, 4];
167168
fixture.detectChanges();
169+
tick();
168170

169171
expect(inkBar.alignToElement).toHaveBeenCalled();
170-
});
172+
}));
171173

172174
it('should re-align the ink bar when the tab labels change the width', done => {
173175
const inkBar = fixture.componentInstance.tabNavBar._inkBar;

0 commit comments

Comments
 (0)