Skip to content

Commit d8661d6

Browse files
committed
test: add warnings for maxCount
1 parent c4b2e13 commit d8661d6

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/Select.warning.spec.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,25 @@ describe('TreeSelect.warning', () => {
7171
'Warning: Second param of `onDropdownVisibleChange` has been removed.',
7272
);
7373
});
74+
75+
it('warns on using maxCount with showCheckedStrategy=SHOW_ALL when treeCheckStrictly=false', () => {
76+
mount(<TreeSelect maxCount={2} showCheckedStrategy="SHOW_ALL" />);
77+
expect(spy).toHaveBeenCalledWith(
78+
'Warning: `maxCount` not work with `showCheckedStrategy=SHOW_ALL` (when `treeCheckStrictly=false`) or `showCheckedStrategy=SHOW_PARENT`.',
79+
);
80+
});
81+
82+
it('warns on using maxCount with showCheckedStrategy=SHOW_PARENT', () => {
83+
mount(<TreeSelect maxCount={2} showCheckedStrategy="SHOW_PARENT" />);
84+
expect(spy).toHaveBeenCalledWith(
85+
'Warning: `maxCount` not work with `showCheckedStrategy=SHOW_ALL` (when `treeCheckStrictly=false`) or `showCheckedStrategy=SHOW_PARENT`.',
86+
);
87+
});
88+
89+
it('does not warn on using maxCount with showCheckedStrategy=SHOW_ALL when treeCheckStrictly=true', () => {
90+
mount(<TreeSelect maxCount={2} showCheckedStrategy="SHOW_ALL" treeCheckStrictly />);
91+
expect(spy).not.toHaveBeenCalledWith(
92+
'Warning: `maxCount` not work with `showCheckedStrategy=SHOW_ALL` (when `treeCheckStrictly=false`) or `showCheckedStrategy=SHOW_PARENT`.',
93+
);
94+
});
7495
});

0 commit comments

Comments
 (0)