TableNG: Fallback to AutoCell when cellType is unmapped (#107920)
This commit is contained in:
@@ -141,6 +141,14 @@ describe('TableNG Cells renderers', () => {
|
||||
expect(container).toBeInTheDocument();
|
||||
expect(container.childNodes).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('should return AutoCell when cellOptions is unmapped', () => {
|
||||
const field = createField(FieldType.string);
|
||||
|
||||
const { container } = renderCell(field, { type: 'number' } as unknown as TableCellOptions);
|
||||
expect(container).toBeInTheDocument();
|
||||
expect(container.childNodes).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ export function getCellRenderer(field: Field, cellOptions: TableCellOptions): Ta
|
||||
if (cellType === TableCellDisplayMode.Auto) {
|
||||
return getAutoRendererResult(field);
|
||||
}
|
||||
return CELL_RENDERERS[cellType];
|
||||
return CELL_RENDERERS[cellType] ?? AUTO_RENDERER;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
|
||||
Reference in New Issue
Block a user