Skip to content

Commit

Permalink
Merge 4d7a6a0 into ee752c6
Browse files Browse the repository at this point in the history
  • Loading branch information
kYem committed Jul 25, 2020
2 parents ee752c6 + 4d7a6a0 commit 8e01213
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions __snapshots__/src/index.test.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ Generated by [AVA](https://ava.li).
id="rdts"
inlineSearchInput={false}
mode="radioSelect"
onAction={Function onAction {}}
onBlur={Function onBlur {}}
onChange={Function onChange {}}
onFocus={Function onFocus {}}
Expand Down Expand Up @@ -609,6 +610,7 @@ Generated by [AVA](https://ava.li).
}
id="rdts"
inlineSearchInput={false}
onAction={Function onAction {}}
onBlur={Function onBlur {}}
onChange={Function onChange {}}
onFocus={Function onFocus {}}
Expand Down
Binary file modified __snapshots__/src/index.test.js.snap
Binary file not shown.
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class DropdownTreeSelect extends Component {
}

static defaultProps = {
onAction: () => {},
onFocus: () => {},
onBlur: () => {},
onChange: () => {},
Expand Down
9 changes: 9 additions & 0 deletions src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ test('notifies on action', t => {
t.true(handler.calledWithExactly(node0, action))
})

test('notifies on action without onAction handler', t => {
const handler = spy(console, 'error')
const { tree } = t.context
const wrapper = mount(<DropdownTreeSelect id={dropdownId} data={tree} showDropdown="initial" />)
wrapper.find('i.fa-ban').simulate('click')
t.true(handler.notCalled)
handler.restore()
})

test('notifies on node toggle', t => {
const handler = spy()
const { tree } = t.context
Expand Down

0 comments on commit 8e01213

Please sign in to comment.