Skip to content

Commit

Permalink
refactor: remove antd (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
orzyyyy authored Nov 28, 2019
1 parent b14cf0c commit b3e3e89
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
]
},
"dependencies": {
"antd": "^4.0.0-alpha.2",
"core-js": "^3.4.1",
"react-draggable": "^4.1.0"
},
Expand Down
4 changes: 1 addition & 3 deletions src/tools/TagGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import classNames from 'classnames';
import Draggable, { DraggableEvent, DraggableData } from 'react-draggable';
import { Input } from 'antd';
import './css/TagGroup.css';
import { stopPropagation, preventDefault } from '../utils/LineUtil';
import { ContextMenuProps, CoordinatesProps, CommonProps } from '../canvas/core';
Expand Down Expand Up @@ -64,12 +63,11 @@ const TagGroup = ({ data, onChange, onContextMenu, className: parentClassName, l
}}
key={key}
>
<Input.TextArea
<textarea
className="animate-appear"
onChange={e => handleChange(item, key, 'input', e.target.value)}
value={item.input}
autoFocus
autoSize
onBlur={() => handleChange(item, key, 'editable', false)}
/>
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/tools/__tests__/TagGroup.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('TagGroup', () => {
},
},
});
expect(wrapper.find('TextArea').prop('value')).toBe('test1');
expect(wrapper.find('textarea').prop('value')).toBe('test1');
});

it('double click should work correctly', () => {
Expand Down Expand Up @@ -65,7 +65,7 @@ describe('TagGroup', () => {
const wrapper = mount(
<TagGroup data={data as any} onChange={jest.fn()} onContextMenu={jest.fn()} lineData={{}} onWheel={onWheel} />,
);
wrapper.find('TextArea').simulate('change', { target: { value: 'test1' } });
wrapper.find('textarea').simulate('change', { target: { value: 'test1' } });
expect(wrapper.find('TagGroup').props().data).toEqual({
tag: {
editable: true,
Expand Down Expand Up @@ -116,7 +116,7 @@ describe('TagGroup', () => {
onWheel={onWheel}
/>,
);
wrapper.find('TextArea').simulate('change', { target: { value: '1' } });
wrapper.find('textarea').simulate('change', { target: { value: '1' } });
expect(onChange).toHaveBeenCalled();
});

Expand All @@ -139,7 +139,7 @@ describe('TagGroup', () => {
onWheel={onWheel}
/>,
);
wrapper.find('TextArea').simulate('blur');
wrapper.find('textarea').simulate('blur');
expect(onChange).toHaveBeenCalled();
});

Expand Down

0 comments on commit b3e3e89

Please sign in to comment.