Skip to content

Commit

Permalink
test: update unit case
Browse files Browse the repository at this point in the history
  • Loading branch information
anlyyao committed Jun 26, 2023
1 parent 9a3b225 commit e092a2d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/textarea/__test__/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,21 @@ describe('Textarea.vue', () => {
const wrapper = mount(
<Textarea label="标题" v-model={value.value} maxcharacter={maxcharacter} onChange={onChange} />,
);
expect(onChange).toBeCalledTimes(1);
const el = wrapper.find('textarea').element;
await simulateEvent(el, '一个汉字等于两个字符,超出会被剪切', 'input');
expect(onChange).toBeCalledTimes(1);
expect(onChange).toBeCalledTimes(2);
expect(onChange).toHaveBeenCalledWith('一');
});

it(': autosize ', async () => {
const value = ref('');
const onChange = vi.fn();
const wrapper = mount(<Textarea label="标题" v-model={value.value} autosize onChange={onChange} />);
expect(onChange).toBeCalledTimes(1);
const el = wrapper.find('textarea').element;
await simulateEvent(el, '这里是一段很长很长很长的长文本,支持自动换行', 'input');
expect(onChange).toBeCalledTimes(1);
expect(onChange).toBeCalledTimes(2);
});

it(': placeholder', async () => {
Expand Down

0 comments on commit e092a2d

Please sign in to comment.