UNPKG

lucid-ui

Version:

A UI component library from AppNexus.

41 lines 1.66 kB
import { shallow } from 'enzyme'; import React from 'react'; import { common } from '../../util/generic-tests'; import InfiniteSlidePanel from './InfiniteSlidePanel'; describe('InfiniteSlidePanel', function () { common(InfiniteSlidePanel, { getDefaultProps: function getDefaultProps() { return { children: function children(slideOffset) { return /*#__PURE__*/React.createElement("span", null, slideOffset); } }; } }); describe('required children', function () { it('should throw if not passed a function or Slide as children', function () { expect(function () { shallow( /*#__PURE__*/React.createElement(InfiniteSlidePanel, null)); }).toThrowErrorMatchingSnapshot(); }); it('should throw if child slide not passed a function child', function () { expect(function () { shallow( /*#__PURE__*/React.createElement(InfiniteSlidePanel, null, /*#__PURE__*/React.createElement(InfiniteSlidePanel.Slide, null, "foo"))); }).toThrowErrorMatchingSnapshot(); }); it('should not throw if passed a Slide child element with function child', function () { expect(function () { shallow( /*#__PURE__*/React.createElement(InfiniteSlidePanel, null, /*#__PURE__*/React.createElement(InfiniteSlidePanel.Slide, null, function () { return null; }))); }).not.toThrow(); }); it('should not throw if passed a function child', function () { expect(function () { shallow( /*#__PURE__*/React.createElement(InfiniteSlidePanel, null, function () { return null; })); }).not.toThrow(); }); }); });