Skip to content

Commit d26e13b

Browse files
committed
feat: use input instance to expect value
1 parent c230a2c commit d26e13b

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

tests/Input.test.tsx

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { mount } from 'enzyme'
22
import React from 'react'
33

4-
import { sleep } from './util'
5-
64
import Input from '../src'
75

86
describe('src/index', () => {
@@ -24,30 +22,14 @@ describe('src/index', () => {
2422
})
2523
})
2624

27-
describe('simulate events', async () => {
25+
describe.only('simulate events', async () => {
2826
let wrapper
2927
it('onchange event', async () => {
3028
wrapper = mount(<RenderInput />)
3129
const input = wrapper.find('.or-input input')
32-
input.instance().value = 'yuki'
33-
input.simulate('change')
34-
// input.simulate('focus');
35-
// input.simulate('change', { target: { value: 'Changed' } });
36-
// input.simulate('keyDown', {
37-
// which: 72,
38-
// target: {
39-
// blur() {
40-
// // Needed since <EditableText /> calls target.blur()
41-
// input.simulate('blur');
42-
// },
43-
// },
44-
// })
45-
// await sleep(500)
46-
// expect(input.props().value).toBe('Hello');
47-
// input.simulate('change', { target: { value: 'yuki' } })
48-
// expect(wrapper.find('input').prop('value')).toBe('yuki')
30+
input.simulate('change', { target: { value: 'Changed' } })
4931

50-
expect(input.value).toBe('yuki')
32+
expect(input.instance().value).toBe('Changed')
5133
})
5234
})
5335
})

0 commit comments

Comments
 (0)