Use snapshot test for grid

This commit is contained in:
Wei Zhu 2017-09-15 10:56:00 +08:00
parent 2437ca419e
commit 6acf6fc643
2 changed files with 18 additions and 7 deletions

View File

@ -0,0 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Grid should render Col 1`] = `
<div
class="ant-col-2"
/>
`;
exports[`Grid should render Row 1`] = `
<div
class="ant-row"
/>
`;

View File

@ -1,20 +1,18 @@
import React from 'react';
import TestUtils from 'react-dom/test-utils';
import { render } from 'enzyme';
import { Col, Row } from '..';
describe('Grid', () => {
it('should render Col', () => {
const col = TestUtils.renderIntoDocument(
const wrapper = render(
<Col span="2" />
);
const colNode = TestUtils.findRenderedDOMComponentWithTag(col, 'DIV');
expect(colNode.className).toBe('ant-col-2');
expect(wrapper).toMatchSnapshot();
});
it('should render Row', () => {
const row = TestUtils.renderIntoDocument(
const wrapper = render(
<Row />
);
const rowNode = TestUtils.findRenderedDOMComponentWithTag(row, 'DIV');
expect(rowNode.className).toBe('ant-row');
expect(wrapper).toMatchSnapshot();
});
});