Skip to content

Commit

Permalink
simpler test case
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Nov 11, 2020
1 parent e257dda commit 5092d74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
12 changes: 4 additions & 8 deletions packages/grid/data-grid/src/DataGrid.test.tsx
Expand Up @@ -136,18 +136,13 @@ describe('<DataGrid />', () => {
);
});
});

describe('state', () => {
it('should allow to control the state using useState', async () => {
function GridStateTest({ direction, sortedRows }) {
const [gridState, setGridState] = React.useState<Partial<GridState>>({
const gridState = {
sorting: { sortModel: [{ field: 'brand', sort: direction }], sortedRows },
});

React.useEffect(() => {
setGridState({
sorting: { sortModel: [{ field: 'brand', sort: direction }], sortedRows },
});
}, [direction, sortedRows]);
};

return (
<div style={{ width: 300, height: 500 }}>
Expand All @@ -163,6 +158,7 @@ describe('<DataGrid />', () => {
});
});
});

describe('warnings', () => {
before(() => {
PropTypes.resetWarningCache();
Expand Down
1 change: 1 addition & 0 deletions packages/grid/x-grid/src/XGrid.test.tsx
Expand Up @@ -244,6 +244,7 @@ describe('<XGrid />', () => {
expect(onStateParams.state).to.equal(apiRef.current.state);
expect(onStateParams.state).to.not.equal(undefined);
});

it('should allow to control the state using apiRef', () => {
function GridStateTest() {
const apiRef = useApiRef();
Expand Down

0 comments on commit 5092d74

Please sign in to comment.