Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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