mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
fix(spin): remove false positive warning with tip
and fullscreen
used together (#47015)
* fix(spin): remove false positive warning with `tip` and `fullscreen` used together * fix(spin): update warning text
This commit is contained in:
parent
e727b04fa6
commit
87b45e6198
@ -69,7 +69,18 @@ describe('Spin', () => {
|
||||
const { container } = render(<Spin tip="Not Show" />);
|
||||
expect(container.querySelector('.ant-spin-text')).toBeFalsy();
|
||||
|
||||
expect(errSpy).toHaveBeenCalledWith('Warning: [antd: Spin] `tip` only work in nest pattern.');
|
||||
expect(errSpy).toHaveBeenCalledWith('Warning: [antd: Spin] `tip` only work in nest or fullscreen pattern.');
|
||||
|
||||
errSpy.mockRestore();
|
||||
});
|
||||
|
||||
it('should not warn tip with fullscreen', () => {
|
||||
const errSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
||||
|
||||
const { container } = render(<Spin fullscreen tip="Fullscreen" />);
|
||||
expect(container.querySelector('.ant-spin-fullscreen')).toBeTruthy();
|
||||
|
||||
expect(errSpy).not.toHaveBeenCalled();
|
||||
|
||||
errSpy.mockRestore();
|
||||
});
|
||||
|
@ -82,7 +82,7 @@ const Spin: SpinType = (props) => {
|
||||
wrapperClassName,
|
||||
style,
|
||||
children,
|
||||
fullscreen,
|
||||
fullscreen = false,
|
||||
...restProps
|
||||
} = props;
|
||||
|
||||
@ -118,7 +118,7 @@ const Spin: SpinType = (props) => {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const warning = devUseWarning('Spin');
|
||||
|
||||
warning(!tip || isNestedPattern, 'usage', '`tip` only work in nest pattern.');
|
||||
warning(!tip || isNestedPattern || fullscreen, 'usage', '`tip` only work in nest or fullscreen pattern.');
|
||||
}
|
||||
|
||||
const { direction, spin } = React.useContext<ConfigConsumerProps>(ConfigContext);
|
||||
|
Loading…
Reference in New Issue
Block a user