mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 11:10:01 +08:00
ab83c1b6cb
* docs: fix typos * Update index.zh-CN.md * test: update snapshot * docs: fix demo ref * chore: force trigger ci * chore: force trigger ci * chore: bump dumi ver * fix: Layout.Header token not work as expect --------- Co-authored-by: Lioness100 <jchickmm2@gmail.com> Co-authored-by: Amumu <yoyo837@hotmail.com>
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import React from 'react';
|
|
import Layout from '..';
|
|
import { render } from '../../../tests/utils';
|
|
import ConfigProvider from '../../config-provider';
|
|
import Menu from '../../menu';
|
|
|
|
const { Header } = Layout;
|
|
|
|
describe('Layout.Token', () => {
|
|
it('theme should work', () => {
|
|
const { container } = render(
|
|
<ConfigProvider
|
|
theme={{
|
|
components: {
|
|
Layout: {
|
|
colorBgHeader: '#FF0000',
|
|
},
|
|
Menu: {
|
|
colorItemBg: '#00FF00',
|
|
},
|
|
},
|
|
}}
|
|
>
|
|
<Header>
|
|
<Menu
|
|
theme="dark"
|
|
mode="horizontal"
|
|
defaultSelectedKeys={['2']}
|
|
items={new Array(15).fill(null).map((_, index) => {
|
|
const key = index + 1;
|
|
return {
|
|
key,
|
|
label: `nav ${key}`,
|
|
};
|
|
})}
|
|
/>
|
|
</Header>
|
|
</ConfigProvider>,
|
|
);
|
|
|
|
expect(container.querySelector('.ant-layout-header')).toHaveStyle({
|
|
backgroundColor: '#FF0000',
|
|
});
|
|
expect(container.querySelector('.ant-menu')).toHaveStyle({
|
|
backgroundColor: '#00FF00',
|
|
});
|
|
});
|
|
});
|