Skip to content

Commit 4c6bc71

Browse files
DaZuiZuigithub-actions[bot]tdesign-bot
authored
fix(tag-input): align label content vertically (#4292)
* fix(tag-input): align label content vertically fix #4289 * chore: update common * chore: update common * chore: stash changelog [ci skip] --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: tdesign-bot <tdesign@tencent.com>
1 parent 37029c6 commit 4c6bc71

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

packages/common

packages/components/tag-input/__tests__/tag-input.test.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ describe('TagInput Component', () => {
5050
});
5151
});
5252

53+
test('label renders with tags in break-line mode', () => {
54+
const { container } = render(<TagInput value={['Vue', 'React']} label="Controlled: " />);
55+
const wrapper = container.querySelector('.t-tag-input');
56+
const inputPrefix = container.querySelector('.t-input__prefix');
57+
const label = container.querySelector('.t-tag-input__prefix');
58+
59+
expect(wrapper).toHaveClass('t-tag-input--break-line');
60+
expect(wrapper).toHaveClass('t-tag-input--with-tag');
61+
expect(inputPrefix).toContainElement(label);
62+
expect(inputPrefix.querySelectorAll('.t-tag')).toHaveLength(2);
63+
expect(container.querySelector('.t-input__inner')).toBeTruthy();
64+
});
65+
5366
test('prefixIcon display', async () => {
5467
const text = 'test-prefixIcon';
5568
const { getByText } = await render(<TagInput prefixIcon={<span>{text}</span>} />);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
pr_number: 4292
3+
contributor: DaZuiZui
4+
---
5+
6+
- fix(TagInput): 修复带 `label` 且已有 tag 时,输入内容垂直对齐偏差的问题 @DaZuiZui ([#4292](https://github.com/Tencent/tdesign-react/pull/4292))

0 commit comments

Comments
 (0)