Skip to content

Commit c0feeaf

Browse files
committed
test: Add onFocus call to test; rename function call
1 parent 7cd42b1 commit c0feeaf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/index.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,16 @@ test('deactivates dropdown active on blur', t => {
243243
test('detects click outside', t => {
244244
const { tree } = t.context
245245
const wrapper = mount(<DropdownTreeSelect data={tree} />)
246-
const handleOutsideClick = spy(wrapper.instance(), 'handleOutsideClick')
246+
const handleDropdownCollapse = spy(wrapper.instance(), 'handleDropdownCollapse')
247247

248+
wrapper.instance().onFocus()
248249
wrapper.instance().handleClick()
249250
t.true(wrapper.state().showDropdown)
250251

251252
const event = new MouseEvent('click', { bubbles: true, cancelable: true })
252253
global.document.dispatchEvent(event)
253254

254-
t.true(handleOutsideClick.calledOnce)
255+
t.true(handleDropdownCollapse.calledOnce)
255256
t.false(wrapper.state().showDropdown)
256257
})
257258

0 commit comments

Comments
 (0)