@@ -316,6 +316,22 @@ describe('CdkTable', () => {
316316 expect ( tableElement . firstElementChild ) . toBe ( caption ) ;
317317 } ) ) ;
318318
319+ it ( 'should be able to project colgroup and col' , fakeAsync ( ( ) => {
320+ setupTableTestApp ( NativeHtmlTableWithColgroupAndCol ) ;
321+ fixture . detectChanges ( ) ;
322+
323+ const colgroupsAndCols = Array . from ( tableElement . querySelectorAll ( 'colgroup, col' ) ) ;
324+
325+ expect ( colgroupsAndCols . length ) . toBe ( 3 ) ;
326+ expect ( colgroupsAndCols [ 0 ] . childNodes [ 0 ] ) . toBe ( colgroupsAndCols [ 1 ] ) ;
327+ expect ( colgroupsAndCols [ 2 ] . parentNode ! . nodeName . toLowerCase ( ) ) . toBe ( 'table' ) ;
328+ expect ( colgroupsAndCols . map ( e => e . nodeName . toLowerCase ( ) ) ) . toEqual ( [
329+ 'colgroup' ,
330+ 'col' ,
331+ 'col' ,
332+ ] ) ;
333+ } ) ) ;
334+
319335 describe ( 'with different data inputs other than data source' , ( ) => {
320336 let baseData : TestData [ ] = [
321337 { a : 'a_1' , b : 'b_1' , c : 'c_1' } ,
@@ -2390,6 +2406,34 @@ class NativeHtmlTableWithCaptionApp {
23902406 @ViewChild ( CdkTable ) table : CdkTable < TestData > ;
23912407}
23922408
2409+ @Component ( {
2410+ template : `
2411+ <table cdk-table [dataSource]="dataSource">
2412+ <colgroup>
2413+ <col>
2414+ </colgroup>
2415+ <col>
2416+ <ng-container cdkColumnDef="column_a">
2417+ <th cdk-header-cell *cdkHeaderCellDef> Column A</th>
2418+ <td cdk-cell *cdkCellDef="let row"> {{row.a}}</td>
2419+ </ng-container>
2420+ <ng-container cdkColumnDef="column_b">
2421+ <th cdk-header-cell *cdkHeaderCellDef> Column B</th>
2422+ <td cdk-cell *cdkCellDef="let row"> {{row.b}}</td>
2423+ </ng-container>
2424+
2425+ <tr cdk-header-row *cdkHeaderRowDef="columnsToRender"></tr>
2426+ <tr cdk-row *cdkRowDef="let row; columns: columnsToRender" class="customRowClass"></tr>
2427+ </table>
2428+ `
2429+ } )
2430+ class NativeHtmlTableWithColgroupAndCol {
2431+ dataSource : FakeDataSource | undefined = new FakeDataSource ( ) ;
2432+ columnsToRender = [ 'column_a' , 'column_b' ] ;
2433+
2434+ @ViewChild ( CdkTable ) table : CdkTable < TestData > ;
2435+ }
2436+
23932437@Component ( {
23942438 // Note that we need the `ngSwitch` below in order to surface the issue we're testing for.
23952439 template : `
0 commit comments