@cainiaofe/cn-ui-m
Version:
37 lines (36 loc) • 1.22 kB
JavaScript
import { updateParentNodeInTree } from '../update-parent-node-in-tree';
describe('updateParentNodeInTree', function () {
test('should select all child nodes when selected', function () {
var nodes = [
{
label: 'Node 1',
value: 'Node 1',
pos: '1',
checked: false,
indeterminate: false,
children: [
{
label: 'Child 1',
value: 'Child 1',
checked: true,
children: [],
pos: '1-1',
indeterminate: false,
},
{
label: 'Child 2',
value: 'Child 2',
checked: true,
children: [],
pos: '1-2',
indeterminate: false,
},
],
},
];
var pos = '1-1';
updateParentNodeInTree(nodes, pos);
expect(nodes[0].checked).toBe(true);
expect(nodes[0].indeterminate).toBe(false);
});
});