mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-19 03:54:28 +08:00
20 lines
667 B
TypeScript
20 lines
667 B
TypeScript
|
import React from 'react';
|
||
|
|
||
|
import InputNumber from '..';
|
||
|
import { fireEvent, render } from '../../../tests/utils';
|
||
|
|
||
|
describe('suffix', () => {
|
||
|
it('should support suffix prop', () => {
|
||
|
const { container } = render(<InputNumber suffix={<i>hello</i>} />);
|
||
|
expect(container.querySelector('.ant-input-number-suffix')).toBeInTheDocument();
|
||
|
});
|
||
|
|
||
|
it('should trigger focus when suffix is clicked', () => {
|
||
|
const { container } = render(<InputNumber suffix={<i>antd</i>} />);
|
||
|
|
||
|
const mockFocus = jest.spyOn(container.querySelector('input')!, 'focus');
|
||
|
fireEvent.click(container.querySelector('i')!);
|
||
|
expect(mockFocus).toHaveBeenCalled();
|
||
|
});
|
||
|
});
|