Skip to content

Commit

Permalink
Merge 0c58269 into 05be38c
Browse files Browse the repository at this point in the history
  • Loading branch information
ellinge committed Apr 2, 2019
2 parents 05be38c + 0c58269 commit af46080
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/tree-node/index.test.js
Expand Up @@ -45,7 +45,11 @@ test('notifies node toggle changes', t => {
const onChange = spy()

const wrapper = mount(<TreeNode {...node} onNodeToggle={onChange} />)
wrapper.find('.toggle').simulate('click')
const event = {
stopPropagation: spy(),
nativeEvent: { stopImmediatePropagation: spy() }
}
wrapper.find('.toggle').simulate('click', event)
t.true(onChange.calledWith('0-0-0'))
})

Expand Down
4 changes: 3 additions & 1 deletion src/tree-node/toggle.js
Expand Up @@ -13,7 +13,9 @@ class Toggle extends PureComponent {
id: PropTypes.string
}

onToggle = () => {
onToggle = e => {
e.stopPropagation()
e.nativeEvent.stopImmediatePropagation()
this.props.onNodeToggle(this.props.id)
}

Expand Down

0 comments on commit af46080

Please sign in to comment.