Skip to content

Commit 7be374b

Browse files
committed
Fixed mdc-table tests
1 parent 3a99ccc commit 7be374b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/material-experimental/mdc-table/table.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,14 @@ describe('MDC-based MatTable', () => {
147147
]);
148148
});
149149

150-
it('should apply custom sticky CSS class to sticky cells', () => {
150+
it('should apply custom sticky CSS class to sticky cells', fakeAsync(() => {
151151
let fixture = TestBed.createComponent(StickyTableApp);
152152
fixture.detectChanges();
153+
flushMicrotasks();
153154

154155
const stuckCellElement = fixture.nativeElement.querySelector('table th')!;
155156
expect(stuckCellElement.classList).toContain('mat-mdc-table-sticky');
156-
});
157+
}));
157158

158159
// Note: needs to be fakeAsync so it catches the error.
159160
it('should not throw when a row definition is on an ng-container', fakeAsync(() => {

src/material-experimental/mdc-table/table.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import {ChangeDetectionStrategy, Component, OnInit, ViewEncapsulation} from '@angular/core';
10-
import {CDK_TABLE_TEMPLATE, CdkTable} from '@angular/cdk/table';
10+
import {CDK_TABLE_TEMPLATE, CdkTable, CoalescedStyleScheduler} from '@angular/cdk/table';
1111

1212
@Component({
1313
selector: 'table[mat-table]',
@@ -17,7 +17,10 @@ import {CDK_TABLE_TEMPLATE, CdkTable} from '@angular/cdk/table';
1717
host: {
1818
'class': 'mat-mdc-table mdc-data-table__table',
1919
},
20-
providers: [{provide: CdkTable, useExisting: MatTable}],
20+
providers: [
21+
{provide: CdkTable, useExisting: MatTable},
22+
CoalescedStyleScheduler,
23+
],
2124
encapsulation: ViewEncapsulation.None,
2225
// See note on CdkTable for explanation on why this uses the default change detection strategy.
2326
// tslint:disable-next-line:validate-decorators

0 commit comments

Comments
 (0)