import React from 'react';
import Steps from '..';
import mountTest from '../../../tests/shared/mountTest';
import rtlTest from '../../../tests/shared/rtlTest';
import { render } from '../../../tests/utils';
import { resetWarned } from '../../_util/warning';
describe('Steps', () => {
mountTest(Steps);
rtlTest(Steps);
const description = 'This is a description.';
it('should render correct', () => {
const { container } = render(
,
);
expect(container.firstChild).toMatchSnapshot();
});
it('should render correct when use Step', () => {
const { container } = render(
,
);
expect(container.firstChild).toMatchSnapshot();
});
it('should render correct when use null', () => {
const { container } = render(null);
expect(container.firstChild).toMatchSnapshot();
});
it('deprecated warning', () => {
resetWarned();
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
const { container } = render(
,
);
expect(container.querySelectorAll('.ant-steps-item')).toHaveLength(1);
expect(errorSpy).toHaveBeenCalledWith(
'Warning: [antd: Steps] Step is deprecated. Please use `items` directly.',
);
errorSpy.mockRestore();
});
});