Skip to content

Commit

Permalink
[charts] Add unit test for pie chart with empty series (#16663)
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardobelchior authored Feb 20, 2025
1 parent 75ce81e commit 0063ca6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/x-charts/src/PieChart/PieChart.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as React from 'react';
import { createRenderer } from '@mui/internal-test-utils/createRenderer';
import { createRenderer, screen } from '@mui/internal-test-utils/createRenderer';
import { describeConformance } from 'test/utils/describeConformance';
import { PieChart } from '@mui/x-charts/PieChart';
import { expect } from 'chai';

describe('<PieChart />', () => {
const { render } = createRenderer();
Expand Down Expand Up @@ -38,4 +39,11 @@ describe('<PieChart />', () => {
],
}),
);

it('should render "No Data" overlay when series prop is an empty array', () => {
render(<PieChart height={100} width={100} series={[]} />);

const noDataOverlay = screen.getByText('No data to display');
expect(noDataOverlay).toBeVisible();
});
});

0 comments on commit 0063ca6

Please sign in to comment.