[ADF-1021] custom tooltip formatter for data columns (#2206)

* custom tooltip formatter for data columns

* readme updates

* unit tests
This commit is contained in:
Denys Vuika
2017-08-14 11:26:36 +01:00
committed by Eugenio Romano
parent efd422692c
commit 34b1e38175
10 changed files with 175 additions and 39 deletions

View File

@@ -586,4 +586,41 @@ describe('DataTable', () => {
expect(event.target.src).toBe(originalSrc);
});
it('should not get cell tooltip when row is not provided', () => {
const col = <DataColumn> { key: 'name', type: 'text' };
expect(dataTable.getCellTooltip(null, col)).toBeNull();
});
it('should not get cell tooltip when column is not provided', () => {
const row = <DataRow> {};
expect(dataTable.getCellTooltip(row, null)).toBeNull();
});
it('should not get cell tooltip when formatter is not provided', () => {
const col = <DataColumn> { key: 'name', type: 'text' };
const row = <DataRow> {};
expect(dataTable.getCellTooltip(row, col)).toBeNull();
});
it('should use formatter function to generate tooltip', () => {
const tooltip = 'tooltip value';
const col = <DataColumn> {
key: 'name',
type: 'text',
formatTooltip: () => tooltip
};
const row = <DataRow> {};
expect(dataTable.getCellTooltip(row, col)).toBe(tooltip);
});
it('should return null value from the tooltip formatter', () => {
const col = <DataColumn> {
key: 'name',
type: 'text',
formatTooltip: () => null
};
const row = <DataRow> {};
expect(dataTable.getCellTooltip(row, col)).toBeNull();
});
});