Skip to content

Commit

Permalink
test(Table): added missing test for incorrect param
Browse files Browse the repository at this point in the history
ISSUES CLOSED: #1392
  • Loading branch information
benjamincharity committed Mar 18, 2019
1 parent 225eb46 commit f2159c2
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions terminus-ui/table/src/table.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,37 @@ class TableColumnAlignmentTableApp {

}

@Component({
template: `
<ts-table [dataSource]="dataSource" tsSort>
<ng-container tsColumnDef="column_a" alignment="top">
<ts-header-cell *tsHeaderCellDef>Column A</ts-header-cell>
<ts-cell *tsCellDef="let row">{{ row.a }}</ts-cell>
</ng-container>
<ts-header-row *tsHeaderRowDef="columnsToRender"></ts-header-row>
<ts-row *tsRowDef="let row; columns: columnsToRender"></ts-row>
</ts-table>
`,
})
class TableColumnInvalidAlignmentTableApp {
underlyingDataSource = new FakeDataSource();
dataSource = new TsTableDataSource<TestData>();
columnsToRender = ['column_a'];

@ViewChild(TsTableComponent) table!: TsTableComponent<TestData>;

constructor() {
this.underlyingDataSource.data = [];

// Add a row of data
this.underlyingDataSource.addData();

this.underlyingDataSource.connect().subscribe((data) => {
this.dataSource.data = data;
});
}

}


// Utilities copied from CDKTable's spec
Expand Down Expand Up @@ -452,6 +482,20 @@ describe(`TsTableComponent`, function() {

});


describe(`invalid alignment argument`, () => {

test(`should throw warning`, () => {
window.console.warn = jest.fn();
let fixture: ComponentFixture<TableColumnInvalidAlignmentTableApp>;
fixture = createComponent(TableColumnInvalidAlignmentTableApp);
fixture.detectChanges();

expect(window.console.warn).toHaveBeenCalled();
});

});

});


Expand Down

0 comments on commit f2159c2

Please sign in to comment.