-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Allow same option to be reselected right after it's deselected (#…
- Loading branch information
Showing
3 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import test from 'ava' | ||
import TreeManager from '..' | ||
|
||
test('should select the same node if it is selected and then deselected right again', t => { | ||
const tree = [{ id: 'nodeA' }, { id: 'nodeB' }, { id: 'nodeC' }] | ||
|
||
const manager = new TreeManager(tree, true) | ||
|
||
// first select a node | ||
manager.setNodeCheckedState('nodeA', true) | ||
|
||
// then deselect the same node | ||
manager.setNodeCheckedState('nodeA', false) | ||
|
||
// then reselect the same node right away | ||
manager.setNodeCheckedState('nodeA', true) | ||
|
||
t.true(manager.getNodeById('nodeA').checked) | ||
}) |