diff --git a/__snapshots__/src/index.test.js.md b/__snapshots__/src/index.test.js.md index 3c7d255b..182f516c 100644 --- a/__snapshots__/src/index.test.js.md +++ b/__snapshots__/src/index.test.js.md @@ -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 {}} @@ -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 {}} diff --git a/__snapshots__/src/index.test.js.snap b/__snapshots__/src/index.test.js.snap index 3a8268af..e5b6eb5d 100644 Binary files a/__snapshots__/src/index.test.js.snap and b/__snapshots__/src/index.test.js.snap differ diff --git a/src/index.js b/src/index.js index 29537e84..726e1c64 100644 --- a/src/index.js +++ b/src/index.js @@ -50,6 +50,7 @@ class DropdownTreeSelect extends Component { } static defaultProps = { + onAction: () => {}, onFocus: () => {}, onBlur: () => {}, onChange: () => {}, diff --git a/src/index.test.js b/src/index.test.js index b6700764..4ce73387 100644 --- a/src/index.test.js +++ b/src/index.test.js @@ -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() + 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