Unverified Commit 1ed2b6ef authored by Sendya's avatar Sendya

fix: test

parent 3304dca5
......@@ -86,7 +86,7 @@ const ProLayout: FunctionalComponent<BasicLayoutProps> = (props, { emit, slots }
return {
[baseClassName.value]: true,
[`screen-${colSize.value}`]: colSize.value,
[`${baseClassName.value}-top-menu`]: props.layout === 'top',
[`${baseClassName.value}-top-menu`]: isTop.value,
[`${baseClassName.value}-is-children`]: props.isChildrenLayout,
[`${baseClassName.value}-fix-siderbar`]: props.fixSiderbar,
[`${baseClassName.value}-${props.layout}`]: props.layout,
......
import './_utils/mock-func';
import { mount } from '@vue/test-utils';
import { mount, shallowMount } from '@vue/test-utils';
import { reactive } from 'vue';
import BasicLayout from '../src/BasicLayout';
const title = 'Pro Tests';
......@@ -48,4 +49,37 @@ describe('BasicLayout', () => {
expect(renderTitle.element.innerHTML).toEqual(title);
expect(renderLogo.attributes()).toHaveProperty('src', logoSrc);
});
it('😄 custom layout mode, navTheme', async () => {
const wrapper = mount({
props: {
theme: {
type: String,
default: 'light',
},
layout: {
type: String,
default: 'mix',
},
},
render() {
return (
<BasicLayout navTheme={this.theme} layout={this.layout}>
<div>content</div>
</BasicLayout>
);
},
});
expect(wrapper.find('.ant-pro-basicLayout-mix').exists()).toBe(true);
expect(wrapper.find('.ant-pro-sider-light').exists()).toBe(true);
// update props
await wrapper.setProps({
theme: 'dark',
layout: 'top',
});
expect(wrapper.find('div.ant-pro-basicLayout-top').exists()).toBe(true);
expect(wrapper.find('.ant-pro-top-nav-header.light').exists()).toBe(false);
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment