2023-06-16 14:04:13 +08:00
|
|
|
import React from 'react';
|
2024-04-08 14:04:08 +08:00
|
|
|
|
2023-06-16 14:04:13 +08:00
|
|
|
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
|
|
|
|
/>,
|
|
|
|
);
|
2023-12-18 17:53:31 +08:00
|
|
|
expect(container.querySelector('.ant-input-number-group-wrapper-disabled')).toBeInTheDocument();
|
2023-06-16 14:04:13 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
it('disabled status when prefix and addon is active', () => {
|
|
|
|
const { container } = render(
|
|
|
|
<InputNumber
|
|
|
|
prefix="¥"
|
|
|
|
addonBefore="Before"
|
|
|
|
addonAfter="After"
|
|
|
|
defaultValue={100}
|
|
|
|
disabled
|
|
|
|
controls
|
|
|
|
/>,
|
|
|
|
);
|
2023-12-18 17:53:31 +08:00
|
|
|
expect(container.querySelector('.ant-input-number-group-wrapper-disabled')).toBeInTheDocument();
|
2023-06-16 14:04:13 +08:00
|
|
|
expect(container.querySelector('.ant-input-number-affix-wrapper-disabled')).toBeInTheDocument();
|
|
|
|
});
|
|
|
|
});
|