Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldzjap committed Aug 25, 2023
2 parents 1063404 + a9b7672 commit 66e48b2
Show file tree
Hide file tree
Showing 5 changed files with 1,257 additions and 1,269 deletions.
20 changes: 20 additions & 0 deletions __tests__/SignaturePad.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ describe('Component', () => {
render(<SignaturePad ref={instance} redrawOnResize />);

const signaturePad = instance.current as SignaturePad;

signaturePad.fromDataURL(signature);

const spy = jest.spyOn(signaturePad.instance, 'toDataURL');

scaleCanvas(768, 768);
Expand All @@ -233,13 +236,30 @@ describe('Component', () => {
render(<SignaturePad ref={instance} redrawOnResize />);

const signaturePad = instance.current as SignaturePad;

signaturePad.fromDataURL(signature);

const spy = jest.spyOn(signaturePad.instance, 'toDataURL');

signaturePad.handleResize();

expect(spy).not.toHaveBeenCalled();
});

it('does not redraw a signature when the canvas is empty', () => {
const instance = React.createRef<SignaturePad>();

render(<SignaturePad ref={instance} redrawOnResize />);

const signaturePad = instance.current as SignaturePad;

expect(signaturePad.isEmpty()).toBeTruthy();

scaleCanvas(768, 768);

expect(signaturePad.isEmpty()).toBeTruthy();
});

it('does not add the resize event listener on mount', () => {
const spy = jest.spyOn(window, 'addEventListener');
const instance = React.createRef<SignaturePad>();
Expand Down
84 changes: 42 additions & 42 deletions example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 66e48b2

Please sign in to comment.