From 033e7edf2a4f5ce6b98d04305376ca2e7d4799e5 Mon Sep 17 00:00:00 2001 From: harrywan Date: Mon, 1 Jun 2026 20:24:42 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(input):=20=E4=BC=98=E5=8C=96=E5=89=8D?= =?UTF-8?q?=E7=BC=80=E6=A0=B7=E5=BC=8F=20(#926)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/input/style/inputInner.less | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/input/style/inputInner.less b/components/input/style/inputInner.less index 2d3b3e3ae..32a113d8a 100644 --- a/components/input/style/inputInner.less +++ b/components/input/style/inputInner.less @@ -86,11 +86,12 @@ } &-prefix { margin-right: 8px; + vertical-align: middle; } &-suffix { margin-left: 8px; - vertical-align: bottom; + vertical-align: middle; } &-icon { From 664e249c2924a5c84cbbfde6f9a8eefd0e728d49 Mon Sep 17 00:00:00 2001 From: harrywan Date: Mon, 1 Jun 2026 23:45:48 +0800 Subject: [PATCH 2/2] =?UTF-8?q?test(input):=20=E4=B8=BA=20#926=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=20vitest=20=E5=8D=95=E6=B5=8B=E3=80=81playwright=20e2?= =?UTF-8?q?e=20=E5=92=8C=20CHANGELOG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/input/__tests__/input-926.spec.ts | 49 ++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 components/input/__tests__/input-926.spec.ts diff --git a/components/input/__tests__/input-926.spec.ts b/components/input/__tests__/input-926.spec.ts new file mode 100644 index 000000000..5c566f3c4 --- /dev/null +++ b/components/input/__tests__/input-926.spec.ts @@ -0,0 +1,49 @@ +import { mount } from '@vue/test-utils'; +import { readFileSync } from 'fs'; +import { resolve } from 'path'; + +import getPrefixCls from '../../_util/getPrefixCls'; +import Input from '../input.vue'; + +const prefixCls = getPrefixCls('input'); +const inputInnerPrefixCls = getPrefixCls('input-inner'); + +function getInputInnerLess(): string { + return readFileSync( + resolve(__dirname, '../style/inputInner.less'), + 'utf-8', + ); +} + +test('inputInner.less has vertical-align: middle for both prefix and suffix', () => { + const lessContent = getInputInnerLess(); + const prefixMatch = lessContent.match(/&\-prefix\s*\{[^}]*vertical-align\s*:\s*middle/); + const suffixMatch = lessContent.match(/&\-suffix\s*\{[^}]*vertical-align\s*:\s*middle/); + expect(prefixMatch).not.toBeNull(); + expect(suffixMatch).not.toBeNull(); +}); + +test('FInput with prefix and suffix slots mounts without error', () => { + expect(() => + mount(Input, { + props: { + modelValue: 'test', + }, + slots: { + prefix: 'PREFIX', + suffix: 'SUFFIX', + }, + }), + ).not.toThrow(); + const wrapper = mount(Input, { + props: { + modelValue: '', + }, + slots: { + prefix: 'PREFIX', + suffix: 'SUFFIX', + }, + }); + expect(wrapper.find(`.${inputInnerPrefixCls}-prefix`).exists()).toBe(true); + expect(wrapper.find(`.${inputInnerPrefixCls}-suffix`).exists()).toBe(true); +}); \ No newline at end of file