Skip to content

Commit

Permalink
feat: 代码优化
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxingkang committed Jun 24, 2019
1 parent ac5cc30 commit e84e21c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions src/camera.test.tsx
Original file line number Diff line number Diff line change
@@ -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(<Camera onPhotograph={handlePhotograph} />);
const button = camera.find('button').at(0);

button.simulate('click');

expect(typeof imgBase64 === 'string').toEqual(true);
})
});
2 changes: 1 addition & 1 deletion src/camera.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<ICameraProps> = (props) => {
Expand Down

0 comments on commit e84e21c

Please sign in to comment.