ant-design/components/input-number/__tests__/addon.test.tsx
KAM 0dcd6e8c22
fix(InputNumber): Fix incorrect disable state style for input box com… (#42974)
* fix(InputNumber): Fix incorrect disable state style for input box components with front and rear label configuration

* fix(InputNumber): Add case previews for pre and post tags and prefix activation in the disabled state in InputNumber, and add corresponding test cases

* fix(InputNumber): Fix the issue of incorrect inputNumber background color caused by the original prefix icon being disabled

* fix(InputNumber): Remove the toggle disable state interaction in the addon case

* fix(InputNumber): Optimize and merge style processing

* fix(InputNumber): Adjust the addon case and remove irrelevant cases

* fix(InputNumber): Update the snapshot in the InputNumber component unit test

* fix(InputNumber): Fix the issue of incorrect test snapshots caused by adjusting the controls in the disabled state display

* fix(InputNumber): Fix the issue of incorrect test snapshots caused by adjusting the controls in the disabled state display

* fix(InputNumber): Fix the issue of incorrect test snapshots caused by adjusting the controls in the disabled state display

* fix(InputNumber): Fix the issue of incorrect test snapshots caused by adjusting the controls in the disabled state display

* fix(InputNumber): Fix the issue of incorrect test snapshots caused by adjusting the controls in the disabled state display
2023-06-16 14:04:13 +08:00

40 lines
1.2 KiB
TypeScript

import React from 'react';
import InputNumber from '..';
import { render } from '../../../tests/utils';
describe('addon', () => {
it('disabled status when prefix is active', () => {
const { container } = render(<InputNumber prefix="¥" defaultValue={100} disabled controls />);
expect(container.querySelector('.ant-input-number-affix-wrapper-disabled')).toBeInTheDocument();
});
it('disabled status when addon is active', () => {
const { container } = render(
<InputNumber
prefix="¥"
addonBefore="Before"
addonAfter="After"
defaultValue={100}
disabled
controls
/>,
);
expect(container.querySelector('.ant-input-number-wrapper-disabled')).toBeInTheDocument();
});
it('disabled status when prefix and addon is active', () => {
const { container } = render(
<InputNumber
prefix="¥"
addonBefore="Before"
addonAfter="After"
defaultValue={100}
disabled
controls
/>,
);
expect(container.querySelector('.ant-input-number-wrapper-disabled')).toBeInTheDocument();
expect(container.querySelector('.ant-input-number-affix-wrapper-disabled')).toBeInTheDocument();
});
});