From e84e21cc4a06b6023738c092fca23fd92efa179f Mon Sep 17 00:00:00 2001 From: wangxingkang Date: Mon, 24 Jun 2019 11:14:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/camera.test.tsx | 20 ++++++++++++++++++++ src/camera.tsx | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/camera.test.tsx diff --git a/src/camera.test.tsx b/src/camera.test.tsx new file mode 100644 index 0000000..72076c8 --- /dev/null +++ b/src/camera.test.tsx @@ -0,0 +1,20 @@ +import { mount } from 'enzyme'; +import React from 'react'; +import Camera from './camera'; + +describe('Camera', () => { + it('Turning a Todo item into Done', () => { + let imgBase64 = undefined; + const handlePhotograph = (base64) => { + imgBase64 = base64; + console.log(base64) + }; + + const camera = mount(); + const button = camera.find('button').at(0); + + button.simulate('click'); + + expect(typeof imgBase64 === 'string').toEqual(true); + }) +}); diff --git a/src/camera.tsx b/src/camera.tsx index 702ce4e..73f0a45 100644 --- a/src/camera.tsx +++ b/src/camera.tsx @@ -8,7 +8,7 @@ export interface ICameraProps { prefixCls?: string; style?: React.CSSProperties; videoWidth?: number; - onPhotograph: (image: string) => void; + onPhotograph?: (image: string) => void; } const Camera: React.FC = (props) => {