import { ComponentsModule } from '../../components/components.module';
import { CdTableColumnFilter } from '../../models/cd-table-column-filter';
import { CdTableFetchDataContext } from '../../models/cd-table-fetch-data-context';
+import { CdTableSelection } from '../../models/cd-table-selection';
import { PipesModule } from '../../pipes/pipes.module';
import { TableComponent } from './table.component';
component.ngOnInit();
});
+ it('should call updateSelection on init', () => {
+ component.updateSelection.subscribe((selection: CdTableSelection) => {
+ expect(selection.hasSelection).toBeFalsy();
+ expect(selection.hasSingleSelection).toBeFalsy();
+ expect(selection.hasMultiSelection).toBeFalsy();
+ expect(selection.selected.length).toBe(0);
+ });
+ component.ngOnInit();
+ });
+
describe('test column filtering', () => {
let filterIndex: CdTableColumnFilter;
let filterOdd: CdTableColumnFilter;
this.filterHiddenColumns();
this.initColumnFilters();
this.updateColumnFilterOptions();
+ // Notify all subscribers to reset their current selection.
+ this.updateSelection.emit(new CdTableSelection());
// Load the data table content every N ms or at least once.
// Force showing the loading indicator if there are subscribers to the fetchData
// event. This is necessary because it has been set to False in useData() when