Skip to content

Commit 66e48b2

Browse files
committed
Merge branch 'develop'
2 parents 1063404 + a9b7672 commit 66e48b2

File tree

5 files changed

+1257
-1269
lines changed

5 files changed

+1257
-1269
lines changed

__tests__/SignaturePad.test.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ describe('Component', () => {
217217
render(<SignaturePad ref={instance} redrawOnResize />);
218218

219219
const signaturePad = instance.current as SignaturePad;
220+
221+
signaturePad.fromDataURL(signature);
222+
220223
const spy = jest.spyOn(signaturePad.instance, 'toDataURL');
221224

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

235238
const signaturePad = instance.current as SignaturePad;
239+
240+
signaturePad.fromDataURL(signature);
241+
236242
const spy = jest.spyOn(signaturePad.instance, 'toDataURL');
237243

238244
signaturePad.handleResize();
239245

240246
expect(spy).not.toHaveBeenCalled();
241247
});
242248

249+
it('does not redraw a signature when the canvas is empty', () => {
250+
const instance = React.createRef<SignaturePad>();
251+
252+
render(<SignaturePad ref={instance} redrawOnResize />);
253+
254+
const signaturePad = instance.current as SignaturePad;
255+
256+
expect(signaturePad.isEmpty()).toBeTruthy();
257+
258+
scaleCanvas(768, 768);
259+
260+
expect(signaturePad.isEmpty()).toBeTruthy();
261+
});
262+
243263
it('does not add the resize event listener on mount', () => {
244264
const spy = jest.spyOn(window, 'addEventListener');
245265
const instance = React.createRef<SignaturePad>();

example/package-lock.json

Lines changed: 42 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)