"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/cdk/table/table.spec.ts" between
material2-7.3.2.tar.gz and material2-7.3.3.tar.gz

About: material2 offers Material Design components for Angular.

table.spec.ts  (material2-7.3.2):table.spec.ts  (material2-7.3.3)
skipping to change at line 508 skipping to change at line 508
thisFixture.detectChanges(); thisFixture.detectChanges();
expectTableToMatchContent(thisTableElement, [ expectTableToMatchContent(thisTableElement, [
['Column A', 'Column B', 'Column C'], ['Column A', 'Column B', 'Column C'],
['a_1', 'b_1', 'c_1'], ['a_1', 'b_1', 'c_1'],
['a_2', 'b_2', 'c_2'], ['a_2', 'b_2', 'c_2'],
['a_3', 'b_3', 'c_3'], ['a_3', 'b_3', 'c_3'],
]); ]);
}); });
it('should apply correct roles for native table elements', () => {
const thisFixture = createComponent(NativeHtmlTableApp);
const thisTableElement: HTMLTableElement = thisFixture.nativeElement.querySe
lector('table');
thisFixture.detectChanges();
const rowGroups = Array.from(thisTableElement.querySelectorAll('thead, tbody
, tfoot'));
expect(rowGroups.length).toBe(3, 'Expected table to have a thead, tbody, and
tfoot');
for (const group of rowGroups) {
expect(group.getAttribute('role'))
.toBe('rowgroup', 'Expected thead, tbody, and tfoot to have role="rowg
roup"');
}
});
it('should hide thead/tfoot when there are no header/footer rows', () => {
const thisFixture = createComponent(NativeTableWithNoHeaderOrFooterRows);
const thisTableElement: HTMLTableElement = thisFixture.nativeElement.querySe
lector('table');
thisFixture.detectChanges();
const rowGroups: HTMLElement[] = Array.from(thisTableElement.querySelectorAl
l('thead, tfoot'));
expect(rowGroups.length).toBe(2, 'Expected table to have a thead and tfoot')
;
for (const group of rowGroups) {
expect(group.style.display)
.toBe('none', 'Expected thead and tfoot to be `display: none`');
}
});
it('should render cells even if row data is falsy', () => { it('should render cells even if row data is falsy', () => {
setupTableTestApp(BooleanRowCdkTableApp); setupTableTestApp(BooleanRowCdkTableApp);
expectTableToMatchContent(tableElement, [ expectTableToMatchContent(tableElement, [
[''], // Header row [''], // Header row
['false'], // Data rows ['false'], // Data rows
['true'], ['true'],
['false'], ['false'],
['true'], ['true'],
]); ]);
}); });
skipping to change at line 1592 skipping to change at line 1618
<cdk-cell *cdkCellDef="let row"> {{row.b}}</cdk-cell> <cdk-cell *cdkCellDef="let row"> {{row.b}}</cdk-cell>
</ng-container> </ng-container>
<ng-container cdkColumnDef="column_c"> <ng-container cdkColumnDef="column_c">
<cdk-header-cell *cdkHeaderCellDef> Column C</cdk-header-cell> <cdk-header-cell *cdkHeaderCellDef> Column C</cdk-header-cell>
<cdk-cell *cdkCellDef="let row"> {{row.c}}</cdk-cell> <cdk-cell *cdkCellDef="let row"> {{row.c}}</cdk-cell>
</ng-container> </ng-container>
<ng-container cdkColumnDef="index1Column"> <ng-container cdkColumnDef="index1Column">
<cdk-header-cell *cdkHeaderCellDef> Column C</cdk-header-cell> <cdk-header-cell *cdkHeaderCellDef> Column C</cdk-header-cell>
<cdk-cell *cdkCellDef="let row"> index_1_special_row</cdk-cell> <cdk-cell *cdkCellDef> index_1_special_row</cdk-cell>
</ng-container> </ng-container>
<ng-container cdkColumnDef="c3Column"> <ng-container cdkColumnDef="c3Column">
<cdk-header-cell *cdkHeaderCellDef> Column C</cdk-header-cell> <cdk-header-cell *cdkHeaderCellDef> Column C</cdk-header-cell>
<cdk-cell *cdkCellDef="let row"> c3_special_row</cdk-cell> <cdk-cell *cdkCellDef> c3_special_row</cdk-cell>
</ng-container> </ng-container>
<ng-container cdkColumnDef="index"> <ng-container cdkColumnDef="index">
<cdk-header-cell *cdkHeaderCellDef> Index</cdk-header-cell> <cdk-header-cell *cdkHeaderCellDef> Index</cdk-header-cell>
<cdk-cell *cdkCellDef="let row; let index = index"> {{index}}</cdk-cell> <cdk-cell *cdkCellDef="let index = index"> {{index}}</cdk-cell>
</ng-container> </ng-container>
<ng-container cdkColumnDef="dataIndex"> <ng-container cdkColumnDef="dataIndex">
<cdk-header-cell *cdkHeaderCellDef> Data Index</cdk-header-cell> <cdk-header-cell *cdkHeaderCellDef> Data Index</cdk-header-cell>
<cdk-cell *cdkCellDef="let row; let dataIndex = dataIndex"> {{dataIndex} }</cdk-cell> <cdk-cell *cdkCellDef="let dataIndex = dataIndex"> {{dataIndex}}</cdk-ce ll>
</ng-container> </ng-container>
<ng-container cdkColumnDef="renderIndex"> <ng-container cdkColumnDef="renderIndex">
<cdk-header-cell *cdkHeaderCellDef> Render Index</cdk-header-cell> <cdk-header-cell *cdkHeaderCellDef> Render Index</cdk-header-cell>
<cdk-cell *cdkCellDef="let row; let renderIndex = renderIndex"> {{render Index}}</cdk-cell> <cdk-cell *cdkCellDef="let renderIndex = renderIndex"> {{renderIndex}}</ cdk-cell>
</ng-container> </ng-container>
<cdk-header-row *cdkHeaderRowDef="columnsToRender"></cdk-header-row> <cdk-header-row *cdkHeaderRowDef="columnsToRender"></cdk-header-row>
<cdk-row *cdkRowDef="let row; columns: columnsToRender"></cdk-row> <cdk-row *cdkRowDef="let row; columns: columnsToRender"></cdk-row>
<cdk-row *cdkRowDef="let row; columns: columnsForIsIndex1Row; when: isInde x1"></cdk-row> <cdk-row *cdkRowDef="let row; columns: columnsForIsIndex1Row; when: isInde x1"></cdk-row>
<cdk-row *cdkRowDef="let row; columns: columnsForHasC3Row; when: hasC3"></ cdk-row> <cdk-row *cdkRowDef="let row; columns: columnsForHasC3Row; when: hasC3"></ cdk-row>
</cdk-table> </cdk-table>
` `
}) })
class WhenRowCdkTableApp { class WhenRowCdkTableApp {
skipping to change at line 1663 skipping to change at line 1689
<cdk-cell *cdkCellDef="let row"> {{row.b}}</cdk-cell> <cdk-cell *cdkCellDef="let row"> {{row.b}}</cdk-cell>
</ng-container> </ng-container>
<ng-container cdkColumnDef="column_c"> <ng-container cdkColumnDef="column_c">
<cdk-header-cell *cdkHeaderCellDef> Column C</cdk-header-cell> <cdk-header-cell *cdkHeaderCellDef> Column C</cdk-header-cell>
<cdk-cell *cdkCellDef="let row"> {{row.c}}</cdk-cell> <cdk-cell *cdkCellDef="let row"> {{row.c}}</cdk-cell>
</ng-container> </ng-container>
<ng-container cdkColumnDef="index1Column"> <ng-container cdkColumnDef="index1Column">
<cdk-header-cell *cdkHeaderCellDef> Column C</cdk-header-cell> <cdk-header-cell *cdkHeaderCellDef> Column C</cdk-header-cell>
<cdk-cell *cdkCellDef="let row"> index_1_special_row </cdk-cell> <cdk-cell *cdkCellDef> index_1_special_row </cdk-cell>
</ng-container> </ng-container>
<ng-container cdkColumnDef="c3Column"> <ng-container cdkColumnDef="c3Column">
<cdk-header-cell *cdkHeaderCellDef> Column C</cdk-header-cell> <cdk-header-cell *cdkHeaderCellDef> Column C</cdk-header-cell>
<cdk-cell *cdkCellDef="let row"> c3_special_row </cdk-cell> <cdk-cell *cdkCellDef> c3_special_row </cdk-cell>
</ng-container> </ng-container>
<cdk-header-row *cdkHeaderRowDef="columnsToRender"></cdk-header-row> <cdk-header-row *cdkHeaderRowDef="columnsToRender"></cdk-header-row>
<cdk-row *cdkRowDef="let row; columns: ['index1Column']; when: isIndex1">< /cdk-row> <cdk-row *cdkRowDef="let row; columns: ['index1Column']; when: isIndex1">< /cdk-row>
<cdk-row *cdkRowDef="let row; columns: ['c3Column']; when: hasC3"></cdk-ro w> <cdk-row *cdkRowDef="let row; columns: ['c3Column']; when: hasC3"></cdk-ro w>
</cdk-table> </cdk-table>
` `
}) })
class WhenRowWithoutDefaultCdkTableApp { class WhenRowWithoutDefaultCdkTableApp {
dataSource: FakeDataSource = new FakeDataSource(); dataSource: FakeDataSource = new FakeDataSource();
skipping to change at line 1706 skipping to change at line 1732
<cdk-cell *cdkCellDef="let row"> {{row.b}}</cdk-cell> <cdk-cell *cdkCellDef="let row"> {{row.b}}</cdk-cell>
</ng-container> </ng-container>
<ng-container cdkColumnDef="column_c"> <ng-container cdkColumnDef="column_c">
<cdk-header-cell *cdkHeaderCellDef> Column C</cdk-header-cell> <cdk-header-cell *cdkHeaderCellDef> Column C</cdk-header-cell>
<cdk-cell *cdkCellDef="let row"> {{row.c}}</cdk-cell> <cdk-cell *cdkCellDef="let row"> {{row.c}}</cdk-cell>
</ng-container> </ng-container>
<ng-container cdkColumnDef="index1Column"> <ng-container cdkColumnDef="index1Column">
<cdk-header-cell *cdkHeaderCellDef> Column C</cdk-header-cell> <cdk-header-cell *cdkHeaderCellDef> Column C</cdk-header-cell>
<cdk-cell *cdkCellDef="let row"> index_1_special_row </cdk-cell> <cdk-cell *cdkCellDef> index_1_special_row </cdk-cell>
</ng-container> </ng-container>
<ng-container cdkColumnDef="c3Column"> <ng-container cdkColumnDef="c3Column">
<cdk-header-cell *cdkHeaderCellDef> Column C</cdk-header-cell> <cdk-header-cell *cdkHeaderCellDef> Column C</cdk-header-cell>
<cdk-cell *cdkCellDef="let row"> c3_special_row </cdk-cell> <cdk-cell *cdkCellDef> c3_special_row </cdk-cell>
</ng-container> </ng-container>
<cdk-header-row *cdkHeaderRowDef="columnsToRender"></cdk-header-row> <cdk-header-row *cdkHeaderRowDef="columnsToRender"></cdk-header-row>
<cdk-row *cdkRowDef="let row; columns: columnsToRender"></cdk-row> <cdk-row *cdkRowDef="let row; columns: columnsToRender"></cdk-row>
<cdk-row *cdkRowDef="let row; columns: ['index1Column']"></cdk-row> <cdk-row *cdkRowDef="let row; columns: ['index1Column']"></cdk-row>
<cdk-row *cdkRowDef="let row; columns: ['c3Column']; when: hasC3"></cdk-ro w> <cdk-row *cdkRowDef="let row; columns: ['c3Column']; when: hasC3"></cdk-ro w>
</cdk-table> </cdk-table>
` `
}) })
class WhenRowMultipleDefaultsCdkTableApp { class WhenRowMultipleDefaultsCdkTableApp {
skipping to change at line 1791 skipping to change at line 1817
} }
} }
@Component({ @Component({
template: ` template: `
<cdk-table [dataSource]="dataSource" [dir]="dir"> <cdk-table [dataSource]="dataSource" [dir]="dir">
<ng-container [cdkColumnDef]="column" *ngFor="let column of columns" <ng-container [cdkColumnDef]="column" *ngFor="let column of columns"
[sticky]="isStuck(stickyStartColumns, column)" [sticky]="isStuck(stickyStartColumns, column)"
[stickyEnd]="isStuck(stickyEndColumns, column)"> [stickyEnd]="isStuck(stickyEndColumns, column)">
<cdk-header-cell *cdkHeaderCellDef> Header {{column}} </cdk-header-cell> <cdk-header-cell *cdkHeaderCellDef> Header {{column}} </cdk-header-cell>
<cdk-cell *cdkCellDef="let row"> {{column}} </cdk-cell> <cdk-cell *cdkCellDef>{{column}}</cdk-cell>
<cdk-footer-cell *cdkFooterCellDef> Footer {{column}} </cdk-footer-cell> <cdk-footer-cell *cdkFooterCellDef> Footer {{column}} </cdk-footer-cell>
</ng-container> </ng-container>
<cdk-header-row *cdkHeaderRowDef="columns; sticky: isStuck(stickyHeaders, 'header-1')"> <cdk-header-row *cdkHeaderRowDef="columns; sticky: isStuck(stickyHeaders, 'header-1')">
</cdk-header-row> </cdk-header-row>
<cdk-header-row *cdkHeaderRowDef="columns; sticky: isStuck(stickyHeaders, 'header-2')"> <cdk-header-row *cdkHeaderRowDef="columns; sticky: isStuck(stickyHeaders, 'header-2')">
</cdk-header-row> </cdk-header-row>
<cdk-header-row *cdkHeaderRowDef="columns; sticky: isStuck(stickyHeaders, 'header-3')"> <cdk-header-row *cdkHeaderRowDef="columns; sticky: isStuck(stickyHeaders, 'header-3')">
</cdk-header-row> </cdk-header-row>
skipping to change at line 2230 skipping to change at line 2256
class NativeHtmlTableApp { class NativeHtmlTableApp {
dataSource: FakeDataSource | undefined = new FakeDataSource(); dataSource: FakeDataSource | undefined = new FakeDataSource();
columnsToRender = ['column_a', 'column_b', 'column_c']; columnsToRender = ['column_a', 'column_b', 'column_c'];
@ViewChild(CdkTable) table: CdkTable<TestData>; @ViewChild(CdkTable) table: CdkTable<TestData>;
} }
@Component({ @Component({
template: ` template: `
<table cdk-table [dataSource]="dataSource"> <table cdk-table [dataSource]="dataSource">
<ng-container cdkColumnDef="column_a">
<th cdk-header-cell *cdkHeaderCellDef> Column A</th>
<td cdk-cell *cdkCellDef="let row"> {{row.a}}</td>
</ng-container>
<ng-container cdkColumnDef="column_b">
<th cdk-header-cell *cdkHeaderCellDef> Column B</th>
<td cdk-cell *cdkCellDef="let row"> {{row.b}}</td>
</ng-container>
<ng-container cdkColumnDef="column_c">
<th cdk-header-cell *cdkHeaderCellDef> Column C</th>
<td cdk-cell *cdkCellDef="let row"> {{row.c}}</td>
</ng-container>
<tr cdk-row *cdkRowDef="let row; columns: columnsToRender" class="customRo
wClass"></tr>
</table>
`
})
class NativeTableWithNoHeaderOrFooterRows {
dataSource: FakeDataSource | undefined = new FakeDataSource();
columnsToRender = ['column_a', 'column_b', 'column_c'];
@ViewChild(CdkTable) table: CdkTable<TestData>;
}
@Component({
template: `
<table cdk-table [dataSource]="dataSource">
<caption>Very important data</caption> <caption>Very important data</caption>
<ng-container cdkColumnDef="column_a"> <ng-container cdkColumnDef="column_a">
<th cdk-header-cell *cdkHeaderCellDef> Column A</th> <th cdk-header-cell *cdkHeaderCellDef> Column A</th>
<td cdk-cell *cdkCellDef="let row"> {{row.a}}</td> <td cdk-cell *cdkCellDef="let row"> {{row.a}}</td>
</ng-container> </ng-container>
<tr cdk-header-row *cdkHeaderRowDef="columnsToRender"></tr> <tr cdk-header-row *cdkHeaderRowDef="columnsToRender"></tr>
<tr cdk-row *cdkRowDef="let row; columns: columnsToRender" class="customRo wClass"></tr> <tr cdk-row *cdkRowDef="let row; columns: columnsToRender" class="customRo wClass"></tr>
</table> </table>
` `
 End of changes. 12 change blocks. 
10 lines changed or deleted 73 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)