UNPKG

admin-on-rest-fr05t1k

Version:

A frontend Framework for building admin applications on top of REST services, using ES6, React and Material UI

19 lines (16 loc) 859 B
import React from 'react'; import assert from 'assert'; import { shallow } from 'enzyme'; import TextField from './TextField'; describe('<TextField />', () => { it('should display record specific value as plain text', () => { const record = { title: "I'm sorry, Dave. I'm afraid I can't do that." }; const wrapper = shallow(<TextField record={record} source="title" />); assert.equal(wrapper.html(), '<span>I&#x27;m sorry, Dave. I&#x27;m afraid I can&#x27;t do that.</span>'); }); it('should handle deep fields', () => { const record = { foo: { title: "I'm sorry, Dave. I'm afraid I can't do that." } }; const wrapper = shallow(<TextField record={record} source="foo.title" />); assert.equal(wrapper.html(), '<span>I&#x27;m sorry, Dave. I&#x27;m afraid I can&#x27;t do that.</span>'); }); });