import { render } from '@testing-library/react'; import { Chart } from '../Chart/Chart'; import { ChartAxis } from '../ChartAxis/ChartAxis'; import { ChartGroup } from '../ChartGroup/ChartGroup'; import { ChartLine } from '../ChartLine/ChartLine'; import { ChartThemeColor } from '../ChartTheme/ChartThemeColor'; import { ChartLabel } from '../ChartLabel/ChartLabel'; import { ChartLegend } from '../ChartLegend/ChartLegend'; import { createContainer } from '../ChartUtils/chart-container'; import { ChartLegendTooltip } from './ChartLegendTooltip'; Object.values([true, false]).forEach(() => { test('ChartLegendTooltip', () => { const { asFragment } = render(); expect(asFragment()).toMatchSnapshot(); }); }); test('allows tooltip via container component', () => { const CursorVoronoiContainer = createContainer('cursor', 'voronoi'); const legendData = [ { name: 'Cats' }, { name: 'Dogs', symbol: { type: 'dash' } }, { name: 'Birds' }, { name: 'Mice' } ]; const { asFragment } = render( `${datum.y !== null ? datum.y : 'no data'}`} labelComponent={ datum.x} /> } mouseFollowTooltips voronoiDimension="x" voronoiPadding={50} /> } legendData={legendData} legendPosition="bottom" legendComponent={} />} height={275} maxDomain={{ y: 10 }} minDomain={{ y: 0 }} padding={{ bottom: 75, // Adjusted to accommodate legend left: 50, right: 50, top: 50 }} themeColor={ChartThemeColor.green} width={450} > } /> } /> ); expect(asFragment()).toMatchSnapshot(); });