You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

31 lines
1.1 KiB

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();
});
});
});