mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
fix lint; add test case
This commit is contained in:
parent
83b2cfe380
commit
fc93f1fc6e
@ -3,6 +3,7 @@ import { CloseOutlined } from '@ant-design/icons';
|
|||||||
|
|
||||||
import type { SelectProps } from '..';
|
import type { SelectProps } from '..';
|
||||||
import Select from '..';
|
import Select from '..';
|
||||||
|
import Form from '../../form';
|
||||||
import { resetWarned } from '../../_util/warning';
|
import { resetWarned } from '../../_util/warning';
|
||||||
import focusTest from '../../../tests/shared/focusTest';
|
import focusTest from '../../../tests/shared/focusTest';
|
||||||
import mountTest from '../../../tests/shared/mountTest';
|
import mountTest from '../../../tests/shared/mountTest';
|
||||||
@ -126,6 +127,43 @@ describe('Select', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('clear icon position', () => {
|
||||||
|
it('normal', () => {
|
||||||
|
const { container } = render(
|
||||||
|
<Select allowClear options={[{ value: '1', label: '1' }]} value="1" />,
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
getComputedStyle(container.querySelector('.ant-select-clear')!).insetInlineEnd,
|
||||||
|
).toEqual('11px');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('hasFeedback, has validateStatus', () => {
|
||||||
|
const { container } = render(
|
||||||
|
<Form>
|
||||||
|
<Form.Item hasFeedback validateStatus="error">
|
||||||
|
<Select allowClear options={[{ value: '1', label: '1' }]} value="1" />,
|
||||||
|
</Form.Item>
|
||||||
|
</Form>,
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
getComputedStyle(container.querySelector('.ant-select-clear')!).insetInlineEnd,
|
||||||
|
).toEqual('33px');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('hasFeedback, no validateStatus', () => {
|
||||||
|
const { container } = render(
|
||||||
|
<Form>
|
||||||
|
<Form.Item hasFeedback validateStatus="">
|
||||||
|
<Select allowClear options={[{ value: '1', label: '1' }]} value="1" />,
|
||||||
|
</Form.Item>
|
||||||
|
</Form>,
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
getComputedStyle(container.querySelector('.ant-select-clear')!).insetInlineEnd,
|
||||||
|
).toEqual('11px');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('Deprecated', () => {
|
describe('Deprecated', () => {
|
||||||
it('should ignore mode="combobox"', () => {
|
it('should ignore mode="combobox"', () => {
|
||||||
const { asFragment } = render(
|
const { asFragment } = render(
|
||||||
|
@ -186,7 +186,7 @@ const genBaseStyle: GenerateStyle<SelectToken> = (token) => {
|
|||||||
|
|
||||||
// ========================= Feedback ==========================
|
// ========================= Feedback ==========================
|
||||||
[`${componentCls}-status`]: {
|
[`${componentCls}-status`]: {
|
||||||
[`&-error, &-warning, &-success, &-validating`]: {
|
'&-error, &-warning, &-success, &-validating': {
|
||||||
[`&${componentCls}-has-feedback`]: {
|
[`&${componentCls}-has-feedback`]: {
|
||||||
[`${componentCls}-clear`]: {
|
[`${componentCls}-clear`]: {
|
||||||
insetInlineEnd: token
|
insetInlineEnd: token
|
||||||
|
Loading…
Reference in New Issue
Block a user