Commit 30e7632c authored by Sendya's avatar Sendya

feat: add global-footer test

parent c3b27a24
......@@ -118,7 +118,7 @@ const SiderMenu: FunctionalComponent<SiderMenuProps> = (props: SiderMenuProps) =
const extraDom = menuExtraRender && menuExtraRender(props);
const defaultMenuDom = (
<BaseMenu
menus={menuData}
menuData={menuData}
theme={props.theme === 'realDark' ? 'dark' : props.theme}
mode="inline"
collapsed={props.collapsed}
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`GlobalFooter 🥩 base use 1`] = `
<footer class="ant-pro-global-footer">
<div class="ant-pro-global-footer-links"><a title="1" target="_blank" href="https://www.github.com/vueComponent/pro-layout">Pro Layout</a><a title="2" target="_blank" href="https://www.github.com/vueComponent/ant-design-vue-pro">Github</a><a title="3" target="_blank" href="https://www.github.com/sendya/">@Sendya</a></div>
<div class="ant-pro-global-footer-copyright"><a href="https://github.com/vueComponent" target="_blank">vueComponent</a></div>
</footer>
`;
import { mount, shallowMount } from '@vue/test-utils';
// import BasicLayout from '../src/BasicLayout';
import ProProvider from '../src/ProProvider';
import GlobalFooter from '../src/GlobalFooter';
import { link } from 'fs';
const testLinks = [
{
key: '1',
title: 'Pro Layout',
href: 'https://www.github.com/vueComponent/pro-layout',
blankTarget: true,
},
{
key: '2',
title: 'Github',
href: 'https://www.github.com/vueComponent/ant-design-vue-pro',
blankTarget: true,
},
{
key: '3',
title: '@Sendya',
href: 'https://www.github.com/sendya/',
blankTarget: true,
}
]
describe('GlobalFooter', () => {
it('🥩 base use', () => {
const wrapper = mount({
render() {
return (<GlobalFooter
links={testLinks}
copyright={(<a href="https://github.com/vueComponent" target="_blank">vueComponent</a>)}
/>);
},
});
expect(wrapper.html()).toMatchSnapshot();
});
it('😄 custom links', () => {
const wrapper = mount({
render() {
return (
<GlobalFooter links={[{
key: '1',
title: 'Pro Layout',
href: 'https://www.github.com/vueComponent/pro-layout',
blankTarget: true,
}]} />
)
},
});
const links = wrapper.findAll('.ant-pro-global-footer-links a');
expect(links).toHaveLength(1);
});
it('😄 custom copyright', () => {
const wrapper = mount({
render() {
return (
<GlobalFooter copyright={(<a href="#copyright">vueComponent</a>)} />
);
},
});
expect(wrapper.find('.ant-pro-global-footer-copyright a').attributes()).toHaveProperty('href', '#copyright');
});
});
import { mount } from '@vue/test-utils';
// import BasicLayout from '../src/BasicLayout';
import { mount, shallowMount } from '@vue/test-utils';
import BasicLayout from '../src/BasicLayout';
describe('BasicLayout', () => {
it('🥩 base use', () => {
// const wrapper = mount(BasicLayout, { });
// const wrapper = mount({
// render() {
// return (
// <BasicLayout />
// )
// },
// });
// console.log(wrapper.html());
// expect(wrapper.html()).toMatchSnapshot();
});
});
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