Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bodymovin committed May 14, 2024
1 parent f837fbe commit 9ecacf3
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions test/useRive.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ describe('useRive', () => {
expect(canvasSpy).toHaveStyle('width: 100px');
});

it.only('updates the canvas dimensions and size if there is a new canvas size calculation', async () => {
it('updates the canvas dimensions and size if there is a new canvas size calculation', async () => {
const params = {
src: 'file-src',
};
Expand All @@ -509,20 +509,17 @@ describe('useRive', () => {
await act(async () => {
result.current.setCanvasRef(canvasSpy);
result.current.setContainerRef(containerSpy);
jest.spyOn(containerSpy, 'clientWidth', 'get').mockReturnValue(200);
jest.spyOn(containerSpy, 'clientHeight', 'get').mockReturnValue(200);
});
await waitFor(() => {
controlledRiveloadCb();
});

await act(async () => {
jest.spyOn(containerSpy, 'clientWidth', 'get').mockReturnValue(200);
jest.spyOn(containerSpy, 'clientHeight', 'get').mockReturnValue(200);
console.log('PRE DISPATCHED');
containerSpy.dispatchEvent(new Event('resize'));
console.log('DISPATCHED');
});

console.log('EXPECTING');
expect(canvasSpy).toHaveAttribute('width', '400');
expect(canvasSpy).toHaveAttribute('height', '400');
});
Expand Down

0 comments on commit 9ecacf3

Please sign in to comment.