Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Oct 9, 2024
1 parent b1f68d0 commit 191aa84
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe('<DataGridPro /> - Edit components', () => {
});
});

it('should call onValueChange if defined', () => {
it('should call onValueChange if defined', async () => {
const onValueChange = spy();

defaultData.columns[0].renderEditCell = (params) =>
Expand All @@ -135,6 +135,8 @@ describe('<DataGridPro /> - Edit components', () => {

const input = within(cell).getByRole<HTMLInputElement>('textbox');
fireEvent.change(input, { target: { value: 'Puma' } });
await act(() => Promise.resolve());

expect(onValueChange.callCount).to.equal(1);
expect(onValueChange.lastCall.args[1]).to.equal('Puma');
});
Expand Down Expand Up @@ -323,7 +325,7 @@ describe('<DataGridPro /> - Edit components', () => {
);
});

it('should call onValueChange if defined', () => {
it('should call onValueChange if defined', async () => {
const onValueChange = spy();

defaultData.columns[0].renderEditCell = (params) =>
Expand All @@ -336,6 +338,7 @@ describe('<DataGridPro /> - Edit components', () => {

const input = cell.querySelector('input')!;
fireEvent.change(input, { target: { value: '2022-02-10' } });
await act(() => Promise.resolve());

expect(onValueChange.callCount).to.equal(1);
expect((onValueChange.lastCall.args[1]! as Date).toISOString()).to.equal(
Expand Down Expand Up @@ -539,7 +542,7 @@ describe('<DataGridPro /> - Edit components', () => {
fireEvent.doubleClick(cell);

expect(cell.textContent!.replace(/[\W]+/, '')).to.equal('Nike'); // We use .replace to remove &ZeroWidthSpace;
await act(() => {
await act(async () => {
apiRef.current.setEditCellValue({ id: 0, field: 'brand', value: 'Adidas' });
});
expect(cell.textContent!.replace(/[\W]+/, '')).to.equal('Adidas');
Expand All @@ -562,7 +565,7 @@ describe('<DataGridPro /> - Edit components', () => {
expect(onValueChange.lastCall.args[1]).to.equal('Adidas');
});

it('should call onCellEditStop', () => {
it('should call onCellEditStop', async () => {
const onCellEditStop = spy();

render(
Expand All @@ -575,6 +578,8 @@ describe('<DataGridPro /> - Edit components', () => {
const cell = getCell(0, 0);
fireEvent.doubleClick(cell);
fireUserEvent.mousePress(document.getElementById('outside-grid')!);
await act(() => Promise.resolve());

expect(onCellEditStop.callCount).to.equal(1);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ describe('<DataGridPro /> - Row pinning', () => {
expect(getCell(0, 1).textContent).to.equal('Joe');
expect(getCell(4, 1).textContent).to.equal('Cory');

await act(() =>
await act(async () =>
apiRef.current.updateRows([
{ id: 3, name: 'Marcus' },
{ id: 4, name: 'Tom' },
Expand Down

0 comments on commit 191aa84

Please sign in to comment.