diff --git a/src/OptionList/Column.tsx b/src/OptionList/Column.tsx index 45f7466a..9cfdb5cf 100644 --- a/src/OptionList/Column.tsx +++ b/src/OptionList/Column.tsx @@ -73,6 +73,9 @@ export default function Column({ // >>>>> checked const checked = checkedSet.has(fullPathKey); + // >>>>> halfChecked + const halfChecked = halfCheckedSet.has(fullPathKey); + // >>>>> Open const triggerOpenPath = () => { if (!disabled && (!hoverOpen || !isMergedLeaf)) { @@ -131,7 +134,7 @@ export default function Column({ ) => { e.stopPropagation(); diff --git a/tests/checkable.spec.tsx b/tests/checkable.spec.tsx index cd198512..7ac2eec2 100644 --- a/tests/checkable.spec.tsx +++ b/tests/checkable.spec.tsx @@ -56,6 +56,7 @@ describe('Cascader.Checkable', () => { // Check cards wrapper.clickOption(2, 1); + expect(wrapper.find('.rc-cascader-checkbox-indeterminate')).toHaveLength(2); expect(wrapper.exists('.rc-cascader-checkbox-indeterminate')).toBeTruthy(); expect(onChange).toHaveBeenCalledWith( [ @@ -75,6 +76,25 @@ describe('Cascader.Checkable', () => { ], ], ); + + // Check fish + wrapper.clickOption(2, 0); + expect(wrapper.find('.rc-cascader-checkbox-indeterminate')).toHaveLength(0); + expect(wrapper.find('.rc-cascader-checkbox-checked')).toHaveLength(5); + expect(onChange).toHaveBeenCalledWith( + [ + // Light + ['light'], + // Bamboo + ['bamboo'], + ], + [ + // Light + [expect.objectContaining({ value: 'light' })], + // Cards + [expect.objectContaining({ value: 'bamboo' })], + ], + ); }); it('click checkbox invoke one onChange', () => { const onChange = jest.fn();