mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 11:10:01 +08:00
Add has sider test case, ref #8077
This commit is contained in:
parent
b3e1192482
commit
0eca38ba2f
@ -30,7 +30,7 @@ exports[`renders ./components/layout/demo/basic.md correctly 1`] = `
|
||||
Header
|
||||
</div>
|
||||
<div
|
||||
class="ant-layout ant-layout-has-sider"
|
||||
class="ant-layout"
|
||||
>
|
||||
<div
|
||||
class="ant-layout-sider"
|
||||
@ -63,7 +63,7 @@ exports[`renders ./components/layout/demo/basic.md correctly 1`] = `
|
||||
Header
|
||||
</div>
|
||||
<div
|
||||
class="ant-layout ant-layout-has-sider"
|
||||
class="ant-layout"
|
||||
>
|
||||
<div
|
||||
class="ant-layout-content"
|
||||
@ -88,7 +88,7 @@ exports[`renders ./components/layout/demo/basic.md correctly 1`] = `
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-layout ant-layout-has-sider"
|
||||
class="ant-layout"
|
||||
>
|
||||
<div
|
||||
class="ant-layout-sider"
|
||||
@ -125,7 +125,7 @@ exports[`renders ./components/layout/demo/basic.md correctly 1`] = `
|
||||
|
||||
exports[`renders ./components/layout/demo/custom-trigger.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-layout ant-layout-has-sider"
|
||||
class="ant-layout"
|
||||
>
|
||||
<div
|
||||
class="ant-layout-sider"
|
||||
@ -309,7 +309,7 @@ exports[`renders ./components/layout/demo/fixed.md correctly 1`] = `
|
||||
|
||||
exports[`renders ./components/layout/demo/fixed-sider.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-layout ant-layout-has-sider"
|
||||
class="ant-layout"
|
||||
>
|
||||
<div
|
||||
class="ant-layout-sider"
|
||||
@ -574,7 +574,7 @@ exports[`renders ./components/layout/demo/fixed-sider.md correctly 1`] = `
|
||||
|
||||
exports[`renders ./components/layout/demo/responsive.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-layout ant-layout-has-sider"
|
||||
class="ant-layout"
|
||||
>
|
||||
<div
|
||||
class="ant-layout-sider"
|
||||
@ -684,7 +684,7 @@ exports[`renders ./components/layout/demo/responsive.md correctly 1`] = `
|
||||
|
||||
exports[`renders ./components/layout/demo/side.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-layout ant-layout-has-sider"
|
||||
class="ant-layout"
|
||||
style="min-height:100vh;"
|
||||
>
|
||||
<div
|
||||
@ -1035,7 +1035,7 @@ exports[`renders ./components/layout/demo/top-side.md correctly 1`] = `
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="ant-layout ant-layout-has-sider"
|
||||
class="ant-layout"
|
||||
style="padding:24px 0;background:#fff;"
|
||||
>
|
||||
<div
|
||||
@ -1206,7 +1206,7 @@ exports[`renders ./components/layout/demo/top-side-2.md correctly 1`] = `
|
||||
</ul>
|
||||
</div>
|
||||
<div
|
||||
class="ant-layout ant-layout-has-sider"
|
||||
class="ant-layout"
|
||||
>
|
||||
<div
|
||||
class="ant-layout-sider"
|
||||
|
27
components/layout/__tests__/index.test.js
Normal file
27
components/layout/__tests__/index.test.js
Normal file
@ -0,0 +1,27 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import Layout from '..';
|
||||
|
||||
const { Sider, Content } = Layout;
|
||||
|
||||
describe('Layout', () => {
|
||||
it('detect the sider as children', async () => {
|
||||
const wrapper = mount(
|
||||
<Layout>
|
||||
<Sider>Sider</Sider>
|
||||
<Content>Content</Content>
|
||||
</Layout>
|
||||
);
|
||||
expect(wrapper.find('.ant-layout').hasClass('ant-layout-has-sider')).toBe(true);
|
||||
});
|
||||
|
||||
it('detect the sider inside the children', async () => {
|
||||
const wrapper = mount(
|
||||
<Layout>
|
||||
<div><Sider>Sider</Sider></div>
|
||||
<Content>Content</Content>
|
||||
</Layout>
|
||||
);
|
||||
expect(wrapper.find('.ant-layout').hasClass('ant-layout-has-sider')).toBe(true);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user