Skip to content

Commit

Permalink
fix(area-dot): regressionon in parameters passed to custom area dot (#…
Browse files Browse the repository at this point in the history
…4481)

<!--- Provide a general summary of your changes in the Title above -->

## Description

<!--- Describe your changes in detail -->
`points` was accidentally filtered out between 2.2 and 2.3 due to silly
`filterProps`. It is an `Area` prop not an SVG prop (besides poly
elements that do not apply here), so it shouldn't be in `filterProps`.
Since it existed in the list of props previously, add it back in
explicitly.

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->
#4480

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->

## How Has This Been Tested?

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
- add an assertion that it exists in an Area test

## Screenshots (if appropriate):

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [X] I have added tests to cover my changes.
- [ ] I have added a storybook story or extended an existing story to
show my changes

Co-authored-by: Coltin Kifer <ckifer@amazon.com>
  • Loading branch information
ckifer and Coltin Kifer committed May 3, 2024
1 parent 4e3cdfd commit 6543df0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/cartesian/Area.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,13 @@ export class Area extends PureComponent<Props, State> {
r: 3,
...areaProps,
...customDotProps,
dataKey,
index: i,
cx: entry.x,
cy: entry.y,
index: i,
dataKey,
value: entry.value,
payload: entry.payload,
points,
};

return Area.renderDotItem(dot, dotProps);
Expand Down
3 changes: 3 additions & 0 deletions test/cartesian/Area.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ describe.each(chartsThatSupportArea)('<Area /> as a child of $testName', ({ Char

describe('dot', () => {
test('Render customized dot when dot is set to be a function', () => {
let areaDotProps;
const renderDot = (props: { cx: number; cy: number }) => {
const { cx, cy } = props;
areaDotProps = props;

return <circle role="cell" key={cx} x={cx} y={cy} r={5} className="customized-dot" />;
};
Expand All @@ -107,6 +109,7 @@ describe.each(chartsThatSupportArea)('<Area /> as a child of $testName', ({ Char
);

expect(screen.getAllByRole('cell')).toHaveLength(data.length);
expect(areaDotProps).toHaveProperty('points');
});

test('Render customized dot when dot is set to be a react element', () => {
Expand Down

0 comments on commit 6543df0

Please sign in to comment.