mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-09 21:38:54 +08:00
3efb68ce6f
* refactor: refactor with BaseInput
* chore: bump rc-mentions & rc-textarea
* test: update snapshots
* test: update snapshots
* chore: bump rc-input
* fix: bump rc-input
* test: update snapshot
* test: update snapshot penta
* test: update snapshot
* fix: optimize function props
* test: update test
* test: update test
* test: update test
* fix: delete useless className
* feat: let baseInput cal class
* chore: bump rc-input-number
* test: update test
* Revert "test: update test"
This reverts commit a44b35a744
.
* test: update snapshot
* test: update snapshot
* test: update snapshot
* chore: bump rc-input-number
* chore: bump rc-input-number & rc-mentions
---------
Co-authored-by: MadCcc <1075746765@qq.com>
25 lines
1004 B
TypeScript
25 lines
1004 B
TypeScript
import React, { forwardRef } from 'react';
|
|
import InputNumber from '..';
|
|
import focusTest from '../../../tests/shared/focusTest';
|
|
import { fireEvent, render } from '../../../tests/utils';
|
|
|
|
describe('prefix', () => {
|
|
focusTest(
|
|
forwardRef((props, ref) => <InputNumber {...props} prefix="A" ref={ref} />),
|
|
{ refFocus: true },
|
|
);
|
|
it('should support className when has prefix', () => {
|
|
const { container } = render(<InputNumber prefix="suffix" className="my-class-name" />);
|
|
expect((container.firstChild as HTMLElement)?.className.includes('my-class-name')).toBe(true);
|
|
expect(container.querySelector('input')?.className.includes('my-class-name')).toBe(false);
|
|
});
|
|
|
|
it('should trigger focus when prefix is clicked', () => {
|
|
const { container } = render(<InputNumber prefix={<i>123</i>} />);
|
|
|
|
const mockFocus = jest.spyOn(container.querySelector('input')!, 'focus');
|
|
fireEvent.click(container.querySelector('i')!);
|
|
expect(mockFocus).toHaveBeenCalled();
|
|
});
|
|
});
|