-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[charts] Fix charts not passing className to root element #13647
Merged
JCQuintas
merged 25 commits into
mui:master
from
JCQuintas:13292-charts-charts-dont-pass-classname-to-root-element
Jul 11, 2024
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
a7b8ddc
Update regular charts and containers
JCQuintas c4fb2f1
Try adding conformance test
JCQuintas eb2a2d8
Add basic test for classnames
JCQuintas e7ef0ad
Properly spread props to the correct elements
JCQuintas c92a7ac
Add barchart conformance
JCQuintas 740ee5d
Add gauge conformance
JCQuintas 37befb8
Improve barchart
JCQuintas ae38aa1
Add linechart conformance
JCQuintas ce5a449
Add piechart conformance
JCQuintas 6f736da
Add scatterchart conformance
JCQuintas 47c199c
Add sparkline conformance
JCQuintas 4333003
Add width to tests
JCQuintas 907f642
Add chartcontainer conformance
JCQuintas 50eb3f8
Update api
JCQuintas 0a9c09d
Fix wrong demo
JCQuintas 97f9c1a
move owner state in
JCQuintas 037162a
Use skip instead of only in conformance
JCQuintas 067f8f7
fix api
JCQuintas a6d39fe
Merge commit '9f19b9fc35b1a78ff09dcffc76eb30bd0b5cf1fb' into 13292-ch…
JCQuintas 6159258
Add use charts container props
JCQuintas eb9c5bb
Merge commit '38def519c262735ca32f31db1cc723d6f46c657e' into 13292-ch…
JCQuintas d4ea7e4
Unify responsive props
JCQuintas 365528f
Revert ref to be in SVG
JCQuintas 9805508
Fix gauge
JCQuintas f82dec6
Actually test refForwarding with correct types
JCQuintas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import * as React from 'react'; | ||
import { createRenderer, describeConformance } from '@mui/internal-test-utils'; | ||
import { BarChart } from './BarChart'; | ||
|
||
describe('<BarChart />', () => { | ||
const { render } = createRenderer(); | ||
|
||
describeConformance( | ||
<BarChart height={100} width={100} series={[{ data: [100, 200] }]} />, | ||
() => ({ | ||
classes: {} as any, | ||
inheritComponent: 'svg', | ||
render, | ||
muiName: 'MuiBarChart', | ||
testComponentPropWith: 'div', | ||
refInstanceof: window.SVGSVGElement, | ||
skip: [ | ||
'componentProp', | ||
'componentsProp', | ||
'slotPropsProp', | ||
'slotPropsCallback', | ||
'slotsProp', | ||
'themeDefaultProps', | ||
'themeStyleOverrides', | ||
'themeVariants', | ||
'themeCustomPalette', | ||
], | ||
}), | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -50,6 +50,8 @@ export const useBarChartProps = (props: BarChartProps) => { | |||||
onHighlightChange, | ||||||
borderRadius, | ||||||
barLabel, | ||||||
className, | ||||||
...rest | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The naming convention in the codebase?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added changes to #13844 |
||||||
} = props; | ||||||
|
||||||
const id = useId(); | ||||||
|
@@ -68,6 +70,7 @@ export const useBarChartProps = (props: BarChartProps) => { | |||||
} as const; | ||||||
|
||||||
const chartContainerProps: ResponsiveChartContainerProps = { | ||||||
...rest, | ||||||
series: series.map((s) => ({ | ||||||
type: 'bar' as const, | ||||||
...s, | ||||||
|
@@ -92,6 +95,7 @@ export const useBarChartProps = (props: BarChartProps) => { | |||||
axisHighlight?.x === 'none' && | ||||||
axisHighlight?.y === 'none' && | ||||||
!onAxisClick, | ||||||
className, | ||||||
}; | ||||||
|
||||||
const barPlotProps: BarPlotProps = { | ||||||
|
27 changes: 27 additions & 0 deletions
27
packages/x-charts/src/ChartContainer/ChartContainer.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import * as React from 'react'; | ||
import { createRenderer, describeConformance } from '@mui/internal-test-utils'; | ||
import { ChartContainer } from './ChartContainer'; | ||
|
||
describe('<ChartContainer />', () => { | ||
const { render } = createRenderer(); | ||
|
||
describeConformance(<ChartContainer height={100} width={100} series={[]} />, () => ({ | ||
classes: {} as any, | ||
inheritComponent: 'svg', | ||
render, | ||
muiName: 'MuiChartContainer', | ||
testComponentPropWith: 'div', | ||
refInstanceof: window.SVGSVGElement, | ||
skip: [ | ||
'componentProp', | ||
'componentsProp', | ||
'slotPropsProp', | ||
'slotPropsCallback', | ||
'slotsProp', | ||
'themeDefaultProps', | ||
'themeStyleOverrides', | ||
'themeVariants', | ||
'themeCustomPalette', | ||
], | ||
})); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It's a public API, it should be:
to get a bit closer to an end-to-end test, and also make it clearer it's public.
x the other cases.