UNPKG

lucid-ui

Version:

A UI component library from AppNexus.

65 lines 2.59 kB
import React from 'react'; import { shallow } from 'enzyme'; import { common } from '../../util/generic-tests'; import Selection from './Selection'; describe('Selection', function () { common(Selection); describe('render', function () { it('should match snapshot for responsiveMode small', function () { var wrapper = shallow( /*#__PURE__*/React.createElement(Selection, { responsiveMode: "small" }, "Yolo")); expect(wrapper).toMatchSnapshot(); }); it('should match snapshot for container', function () { expect(shallow( /*#__PURE__*/React.createElement(Selection, { kind: "container" }, "cont"))).toMatchSnapshot(); }); it('should match snapshot for success', function () { expect(shallow( /*#__PURE__*/React.createElement(Selection, { kind: "success" }, "cont"))).toMatchSnapshot(); }); it('should match snapshot for danger', function () { expect(shallow( /*#__PURE__*/React.createElement(Selection, { kind: "danger" }, "cont"))).toMatchSnapshot(); }); it('should match snapshot for info', function () { expect(shallow( /*#__PURE__*/React.createElement(Selection, { kind: "info" }, "cont"))).toMatchSnapshot(); }); it('should match snapshot for warning', function () { expect(shallow( /*#__PURE__*/React.createElement(Selection, { kind: "warning" }, "cont"))).toMatchSnapshot(); }); it('should match snapshot for non removable', function () { expect(shallow( /*#__PURE__*/React.createElement(Selection, { isRemovable: false }))).toMatchSnapshot(); }); it('should match snapshot for nested selections', function () { var wrapper = shallow( /*#__PURE__*/React.createElement(Selection, null, "Hello", /*#__PURE__*/React.createElement(Selection, null, "There"))); expect(wrapper).toMatchSnapshot(); }); it('should match snapshot for custom icons', function () { var wrapper = shallow( /*#__PURE__*/React.createElement(Selection, null, /*#__PURE__*/React.createElement(Selection.Icon, null, /*#__PURE__*/React.createElement("div", { className: "fake-icon" })))); expect(wrapper).toMatchSnapshot(); }); }); describe('props', function () { it('onRemove', function () { var onRemove = jest.fn(); var wrapper = shallow( /*#__PURE__*/React.createElement(Selection, { onRemove: onRemove })); wrapper.find('CloseIcon').prop('onClick')({}); expect(onRemove).toHaveBeenCalled(); }); }); });