Fixes: https://tracker.ceph.com/issues/45351
Signed-off-by: Tiago Melo <tmelo@suse.com>
component.onClearSearch();
expect(component.rows.length).toBe(10);
});
+
+ it('should work with undefined data', () => {
+ component.data = undefined;
+ component.search = '3';
+ component.updateFilter();
+ expect(component.rows).toBeUndefined();
+ });
});
describe('after ngInit', () => {
updateFilter() {
let rows = this.columnFilters.length !== 0 ? this.doColumnFiltering() : this.data;
- if (this.search.length > 0) {
+ if (this.search.length > 0 && rows) {
const columns = this.columns.filter((c) => c.cellTransformation !== CellTemplate.sparkline);
// update the rows
rows = this.subSearch(rows, TableComponent.prepareSearch(this.search), columns);