Skip to content

Commit

Permalink
fix(TagInput): tagProps should effect minCollapseNum tag (#4465)
Browse files Browse the repository at this point in the history
* fix(TagInput): fix collapseNum tagprops

* fix(TagInput): tagProps should effect collapsed tag
  • Loading branch information
uyarn authored Aug 2, 2024
1 parent 14f3cff commit becfb9e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/tag-input/__tests__/vitest-tag-input.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,17 @@ describe('TagInput Component', () => {
expect(wrapper.findAll('.t-tag--warning').length).toBe(5);
});

it('props.tagProps should effect minCollapseNum tag', () => {
const wrapper = getTagInputValueMount(TagInput, {
tagProps: { theme: 'warning' },
multiple: true,
minCollapsedNum: 2,
value: ['tdesign-vue', 'tdesign-vue-next', 'tdesign-react'],
});
// tagProps 需要作用到 minCollapseNum 的 tag 上,2 个正常展示的tag 和 1 个折叠的 tag 都会被 tagProps 影响
expect(wrapper.findAll('.t-tag--warning').length).toBe(3);
});

it('props.tips is equal this is a tip', () => {
const wrapper = mount(<TagInput tips={'this is a tip'}></TagInput>);
expect(wrapper.findAll('.t-input__tips').length).toBe(1);
Expand Down
2 changes: 1 addition & 1 deletion src/tag-input/useTagList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export default function useTagList(props: TagInputProps) {
});
list.push(
more ?? (
<Tag key="more" size={size.value}>
<Tag key="more" size={size.value} {...tagProps.value}>
+{len}
</Tag>
),
Expand Down

0 comments on commit becfb9e

Please sign in to comment.