add test cases

This commit is contained in:
afc163 2019-10-20 14:38:35 +08:00 committed by 偏右
parent 0d7d837c3f
commit c6efe8c229

View File

@ -35,10 +35,36 @@ describe('Grid', () => {
expect(wrapper).toMatchSnapshot(); expect(wrapper).toMatchSnapshot();
}); });
it('when typeof getGutter is object', () => { it('when typeof gutter is object', () => {
const wrapper = mount(<Row gutter={{ xs: 8, sm: 16, md: 24 }} />); const wrapper = mount(<Row gutter={{ xs: 8, sm: 16, md: 24 }} />);
expect(wrapper.instance().getGutter()).toEqual([8, 0]); expect(wrapper.instance().getGutter()).toEqual([8, 0]);
wrapper.unmount(); });
it('when typeof gutter is object array', () => {
const wrapper = mount(
<Row
gutter={[
{ xs: 8, sm: 16, md: 24, lg: 32, xl: 40 },
{ xs: 8, sm: 16, md: 24, lg: 32, xl: 40 },
]}
/>,
);
expect(wrapper.instance().getGutter()).toEqual([8, 8]);
});
it('when typeof gutter is object array in large screen', () => {
const wrapper = mount(
<Row
gutter={[
{ xs: 8, sm: 16, md: 24, lg: 32, xl: 40 },
{ xs: 8, sm: 16, md: 24, lg: 100, xl: 400 },
]}
/>,
);
wrapper.setState({
screens: { md: true, lg: true, xl: true },
});
expect(wrapper.instance().getGutter()).toEqual([40, 400]);
}); });
it('renders wrapped Col correctly', () => { it('renders wrapped Col correctly', () => {