-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[@mantine/charts]: Fix LineChart Legend and Tooltip to support nested names #6536
Conversation
@@ -1,3 +1,4 @@ | |||
import _ from 'lodash'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mantine/charts
package does not depend on lodash
, this dependency cannot be used.
@@ -11,6 +24,82 @@ const defaultProps: LineChartProps = { | |||
style: { width: 200, height: 200 }, | |||
}; | |||
|
|||
const nestedData = [ | |||
{ | |||
date: 'Mar 22', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too much data, it is not needed for tests, reduce it to 2 items per data array.
import { LineChart, LineChartProps, LineChartStylesNames } from './LineChart'; | ||
|
||
jest.mock('recharts', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this required? Other tests work correctly without it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @rtivital! Thank you for the PR review.
This mock enables LineChart to be rendered in the DOM. Without this mock we are not able to do assertions that elements are in the DOM and rendered correctly. Prior to this the unit tests did not assert that any elements were rendering correctly for LineChart.
Before tests.itSupportsSystemProps were asserting that system properties were supported and this particular test did not rely on LineChart mounting to be able to test elements rendering correctly.
…ve lodash from ChartToolTip
Thanks! |
Fixes #6529
Relates to #5886
Update tooltip payload by unpacking item's not related to the nested name. Then unpack nested details into same object.
Updates getSeriesLabels to account for nested name.
Adds Unit Tests for displaying legend and tooltip label and data.