Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 committed Aug 30, 2022
1 parent 4a5d94a commit 5009ec8
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { ReactWrapper } from 'enzyme';
import { DatatableArgs, ColumnConfigArg } from '../../../../common/expressions';
import { DataContextType } from './types';
import { chartPluginMock } from '@kbn/charts-plugin/public/mocks';
import { EuiLink } from '@elastic/eui';

describe('datatable cell renderer', () => {
const table: Datatable = {
Expand Down Expand Up @@ -146,6 +147,50 @@ describe('datatable cell renderer', () => {
expect(cell.find('.lnsTableCell--multiline').exists()).toBeTruthy();
});

it('renders as EuiLink if oneClickFilter is set', () => {
const MultiLineCellRenderer = createGridCell(
{
a: { convert: (x) => `formatted ${x}` } as FieldFormat,
},
{
columns: [
{
columnId: 'a',
type: 'lens_datatable_column',
oneClickFilter: true,
},
],
sortingColumnId: '',
sortingDirection: 'none',
},
DataContext,
{ get: jest.fn() } as unknown as IUiSettingsClient,
true
);
const cell = mountWithIntl(
<DataContext.Provider
value={{
table,
alignments: {
a: 'right',
},
handleFilterClick: () => {},
}}
>
<MultiLineCellRenderer
rowIndex={0}
colIndex={0}
columnId="a"
setCellProps={() => {}}
isExpandable={false}
isDetails={false}
isExpanded={false}
/>
</DataContext.Provider>
);
expect(cell.find(EuiLink).text()).toEqual('formatted 123');
});

describe('dynamic coloring', () => {
const paletteRegistry = chartPluginMock.createPaletteRegistry();
const customPalette = paletteRegistry.get('custom');
Expand Down

0 comments on commit 5009ec8

Please sign in to comment.