mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-26 01:42:30 +08:00
502dac12aa
* docs: fix code * feat: lint * feat: prettier * feat: test * feat: review * feat: format html * feat: format html
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import React from 'react';
|
|
|
|
import Layout from '..';
|
|
import { render } from '../../../tests/utils';
|
|
|
|
const { Sider, Footer, Header } = Layout;
|
|
|
|
describe('Layout.Warning', () => {
|
|
(['Layout', 'Header', 'Footer', 'Sider'] as const).forEach((tag) => {
|
|
const ComponentMap = { Layout, Header, Footer, Sider };
|
|
|
|
// Since react will not throw warning for same message.
|
|
// We create a new test suite here
|
|
it(`not warning of non-element attr on ${tag}`, () => {
|
|
/**
|
|
* Should not call:
|
|
* Warning: React does not recognize the `suffixCls` prop on a DOM element.
|
|
* If you intentionally want it to appear in the DOM as a custom attribute,
|
|
* spell it as lowercase `suffixcls` instead.
|
|
* If you accidentally passed it from a parent component,
|
|
* remove it from the DOM element.
|
|
*/
|
|
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
|
|
const Component = ComponentMap[tag];
|
|
render(<Component>{tag}</Component>);
|
|
|
|
expect(errorSpy).not.toHaveBeenCalled();
|
|
errorSpy.mockRestore();
|
|
});
|
|
});
|
|
});
|