From 72a2298d106f1bb5f14c6c7966651d0962787456 Mon Sep 17 00:00:00 2001 From: orzyyyy Date: Thu, 28 Nov 2019 08:43:45 +0800 Subject: [PATCH] refactor: remove antd --- package.json | 1 - src/tools/TagGroup.tsx | 4 +--- src/tools/__tests__/TagGroup.test.tsx | 8 ++++---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index f9160601..e53f4e19 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,6 @@ ] }, "dependencies": { - "antd": "^4.0.0-alpha.2", "core-js": "^3.4.1", "react-draggable": "^4.1.0" }, diff --git a/src/tools/TagGroup.tsx b/src/tools/TagGroup.tsx index 718c3fbf..610f5d4a 100644 --- a/src/tools/TagGroup.tsx +++ b/src/tools/TagGroup.tsx @@ -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'; @@ -64,12 +63,11 @@ const TagGroup = ({ data, onChange, onContextMenu, className: parentClassName, l }} key={key} > - handleChange(item, key, 'input', e.target.value)} value={item.input} autoFocus - autoSize onBlur={() => handleChange(item, key, 'editable', false)} /> diff --git a/src/tools/__tests__/TagGroup.test.tsx b/src/tools/__tests__/TagGroup.test.tsx index 610d4bc0..e912ed9a 100644 --- a/src/tools/__tests__/TagGroup.test.tsx +++ b/src/tools/__tests__/TagGroup.test.tsx @@ -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', () => { @@ -65,7 +65,7 @@ describe('TagGroup', () => { const wrapper = mount( , ); - 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, @@ -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(); }); @@ -139,7 +139,7 @@ describe('TagGroup', () => { onWheel={onWheel} />, ); - wrapper.find('TextArea').simulate('blur'); + wrapper.find('textarea').simulate('blur'); expect(onChange).toHaveBeenCalled(); });