UNPKG

react-hold

Version:

Hold the empty presentational components in react.js

114 lines (104 loc) 2.2 kB
import React from 'react'; import { mount } from 'enzyme'; import { Circle, Fill, Square, Table, Text } from '../index'; describe('Holders', function () { it('render Circle correctly', function () { var wrapper = mount(React.createElement( Circle, null, 'foo-0' )); expect(wrapper).toMatchSnapshot(); var props = { color: 'red', width: 50, height: 60, fillerStyle: { width: 40, color: 'blue' } }; wrapper = mount(React.createElement( Circle, props, 'foo-0-1' )); expect(wrapper).toMatchSnapshot(); }); it('render Fill correctly', function () { var wrapper = mount(React.createElement( Fill, null, 'foo-1' )); expect(wrapper).toMatchSnapshot(); var props = { color: 'red', width: '60%', height: '30px' }; wrapper = mount(React.createElement( Fill, props, 'foo-1-1' )); expect(wrapper).toMatchSnapshot(); }); it('render Square correctly', function () { var wrapper = mount(React.createElement( Square, null, 'foo-2' )); expect(wrapper).toMatchSnapshot(); var props = { color: 'red', width: 50, height: 60 }; wrapper = mount(React.createElement( Square, props, 'foo-2-1' )); expect(wrapper).toMatchSnapshot(); }); it('render Table correctly', function () { var wrapper = mount(React.createElement( Table, null, 'foo-3' )); expect(wrapper).toMatchSnapshot(); var props = { color: 'red', width: 360, height: 60, gap: 4 }; wrapper = mount(React.createElement( Table, props, 'foo-3-1' )); expect(wrapper).toMatchSnapshot(); }); it('render Text correctly', function () { var wrapper = mount(React.createElement( Text, null, 'foo-4' )); expect(wrapper).toMatchSnapshot(); var props = { color: 'red', length: 300 }; wrapper = mount(React.createElement( Text, props, 'foo-4-1' )); expect(wrapper).toMatchSnapshot(); }); });