Skip to content

Commit

Permalink
Area, Bar, and Line set their legend payload even when hidden (#4262)
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelVanecek committed Mar 5, 2024
1 parent c696ab8 commit 7a3aece
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/cartesian/Area.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ export class Area extends PureComponent<Props, State> {
const { hide, dot, points, className, top, left, xAxis, yAxis, width, height, isAnimationActive, id } = this.props;

if (hide || !points || !points.length) {
return null;
return <SetAreaLegend {...this.props} />;
}

const { isAnimationFinished } = this.state;
Expand Down
2 changes: 1 addition & 1 deletion src/cartesian/Bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ export class Bar extends PureComponent<Props, State> {
const { hide, data, className, xAxis, yAxis, left, top, width, height, isAnimationActive, background, id } =
this.props;
if (hide || !data || !data.length) {
return null;
return <SetBarLegend {...this.props} />;
}

const { isAnimationFinished } = this.state;
Expand Down
2 changes: 1 addition & 1 deletion src/cartesian/Line.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ export class Line extends PureComponent<Props, State> {
const { hide, dot, points, className, xAxis, yAxis, top, left, width, height, isAnimationActive, id } = this.props;

if (hide || !points || !points.length) {
return null;
return <SetLineLegend {...this.props} />;
}

const { isAnimationFinished } = this.state;
Expand Down
3 changes: 1 addition & 2 deletions test/component/Legend.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,6 @@ describe('<Legend />', () => {
});

it('should pass parameters to the function', () => {
// expect.assertions(1);
const customContent = (params: unknown): null => {
expect(params).toMatchSnapshot();
return null;
Expand Down Expand Up @@ -2263,7 +2262,7 @@ describe('<Legend />', () => {
});

describe('as a child of ScatterChart', () => {
it('should render one legend item for each Radar', () => {
it('should render one legend item for each Scatter', () => {
const { container, getByText } = render(
<ScatterChart width={500} height={500} data={numericalData}>
<Legend />
Expand Down

0 comments on commit 7a3aece

Please sign in to comment.