UNPKG

lucid-ui

Version:

A UI component library from AppNexus.

40 lines (39 loc) 1.51 kB
import React from 'react'; import { shallow } from 'enzyme'; import assert from 'assert'; import { common } from '../../util/generic-tests'; import { SearchFieldDumb as SearchField } from './SearchField'; import TextField from '../TextField/TextField'; describe('SearchField', function () { common(SearchField); describe('props', function () { var fn = function fn() {}; describe('onChange', function () { it('should pass onChange to the text input', function () { var wrapper = shallow( /*#__PURE__*/React.createElement(SearchField, { onChange: fn })); var textFieldWrapper = wrapper.find(TextField).first(); assert.equal(textFieldWrapper.props().onChange, fn); }); }); describe('onChangeDebounced', function () { it('should pass onChangeDebounced to the text input', function () { var wrapper = shallow( /*#__PURE__*/React.createElement(SearchField, { onChangeDebounced: fn })); var textFieldWrapper = wrapper.find(TextField).first(); assert.equal(textFieldWrapper.props().onChangeDebounced, fn); }); }); describe('onSubmit', function () { it('should pass onSubmit to the text input', function () { var wrapper = shallow( /*#__PURE__*/React.createElement(SearchField, { onSubmit: fn })); var textFieldWrapper = wrapper.find(TextField).first(); assert.equal(textFieldWrapper.props().onSubmit, fn); }); }); }); });