Skip to content

Commit

Permalink
fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cherniavskii committed Feb 7, 2025
1 parent b5a728a commit c44e0cf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,15 @@ export function GridSidebarColumnPanelBody({
initialModelKey: FieldTransferObject['modelKey'];
}>(INITIAL_DRAG_STATE);

const initialColumnsLookup = useLazyRef(() => {
const initialColumnsLookup = React.useMemo(() => {
return columns.reduce(
(acc, column) => {
acc[column.field] = column;
return acc;
},
{} as Record<string, GridColDef>,
);
}).current;
}, [columns]);

const getColumnName = React.useCallback(
(field: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ function AggregationSelect({
[colDef, rootProps.aggregationFunctions],
);

if (!colDef) {
return null;
}

return (
<AggregationSelectRoot
as={rootProps.slots.baseSelect}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,8 @@ describe('<DataGridPremium /> - Pivoting', () => {
/>,
);

const columnsBtn = screen.getByRole('button', { name: /Columns/i });
user.click(columnsBtn);

await waitFor(() => {
const pivotSwitch = screen.getByLabelText('Pivot');
user.click(pivotSwitch);
});
const pivotSwitch = screen.getByLabelText('Pivot');
user.click(pivotSwitch);

await waitFor(() => {
const pivotSwitch = screen.getByLabelText('Pivot');
Expand Down Expand Up @@ -213,13 +208,8 @@ describe('<DataGridPremium /> - Pivoting', () => {
/>,
);

const columnsBtn = screen.getByRole('button', { name: /Columns/i });
user.click(columnsBtn);

await waitFor(() => {
const pivotSwitch = screen.getByLabelText('Pivot');
user.click(pivotSwitch);
});
const pivotSwitch = screen.getByLabelText('Pivot');
user.click(pivotSwitch);

await waitFor(() => {
const pivotSwitch = screen.getByLabelText('Pivot');
Expand Down Expand Up @@ -248,13 +238,8 @@ describe('<DataGridPremium /> - Pivoting', () => {
/>,
);

const columnsBtn = screen.getByRole('button', { name: /Columns/i });
user.click(columnsBtn);

await waitFor(() => {
const pivotSwitch = screen.getByLabelText('Pivot');
user.click(pivotSwitch);
});
const pivotSwitch = screen.getByLabelText('Pivot');
user.click(pivotSwitch);

await waitFor(() => {
const pivotSwitch = screen.getByLabelText('Pivot');
Expand Down

0 comments on commit c44e0cf

Please sign in to comment.