test(layout): add test (#2924)

This commit is contained in:
XieZongChen 2022-05-12 22:35:34 +08:00 committed by GitHub
parent bb59bb9d70
commit 10c3a53be5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -160,4 +160,27 @@ describe('n-layout', () => {
)
wrapper.unmount()
})
it('should work with `sider-placement` prop', async () => {
const wrapper = mount(NLayout, {
props: {
hasSider: true
},
slots: {
default: () => [
h(NLayoutSider, null, { default: () => 'test-sider' }),
h(NLayoutContent, null, { default: () => 'test-footer' })
]
}
})
expect(wrapper.find('.n-layout-sider').classes()).toContain(
'n-layout-sider--left-placement'
)
await wrapper.setProps({ siderPlacement: 'right' })
expect(wrapper.find('.n-layout-sider').classes()).toContain(
'n-layout-sider--right-placement'
)
wrapper.unmount()
})
})