└── shared ├── forms ├── fields │ ├── BaseFieldLayout.js │ └── __tests__ │ │ ├── BaseFieldLayout.test.js │ │ └── __snapshots__ │ │ └── BaseFieldLayout.test.js.snap └── inputs │ ├── DateInput.js │ └── __tests__ │ ├── DateInput.test.js │ └── __snapshots__ │ └── DateInput.test.js.snap ├── hoc ├── BaseFieldHOC.js └── __tests__ │ ├── BaseFieldHOC.test.js │ └── __snapshots__ │ └── BaseFieldHOC.test.js.snap ├── modals ├── ModalTrigger.js ├── ModalWrapper.js └── __tests__ │ ├── ModalTrigger.test.js │ ├── ModalWrapper.test.js │ └── __snapshots__ │ ├── ModalTrigger.test.js.snap │ └── ModalWrapper.test.js.snap ├── utils ├── __tests__ │ └── valueToDate.test.js └── valueToDate.js └── widgets ├── Spinner.js └── __tests__ ├── Spinner.test.js └── __snapshots__ └── Spinner.test.js.snap /shared/forms/fields/BaseFieldLayout.js: -------------------------------------------------------------------------------- 1 | import PropTypes from 'prop-types'; 2 | import isString from 'lodash/isString'; 3 | import TooltipIcon from 'shared/widgets/TooltipIcon'; 4 | 5 | const propTypes = { 6 | icon: PropTypes.node, 7 | label: PropTypes.string, 8 | prefix: PropTypes.string, 9 | labelTooltipContent: PropTypes.string, 10 | tooltipContent: PropTypes.string, 11 | required: PropTypes.bool, 12 | inputComponent: PropTypes.func, 13 | className: PropTypes.string, 14 | isMultiple: PropTypes.bool, 15 | fieldLink: PropTypes.element 16 | }, defaultProps = { 17 | className: '', 18 | fieldLink: null 19 | }; 20 | 21 | export default function BaseFieldLayout(props) { 22 | const { 23 | icon, 24 | label, 25 | labelTooltipContent, 26 | fieldLink, 27 | prefix, 28 | tooltipContent, 29 | required, 30 | meta: { touched, error }, 31 | className, 32 | isMultiple, 33 | input: { name }, 34 | inputComponent: InputComponent 35 | } = props; 36 | return ( 37 |
38 | {icon} 39 | 47 | {labelTooltipContent && } 48 |
49 |
50 | {prefix && {prefix}} 51 | {InputComponent && } 55 | {tooltipContent && } 56 |
57 | {fieldLink} 58 | {touched && error && isString(error) && {error}} 59 |
60 |
61 | ); 62 | } 63 | 64 | BaseFieldLayout.propTypes = propTypes; 65 | BaseFieldLayout.defaultProps = defaultProps; 66 | -------------------------------------------------------------------------------- /shared/forms/fields/__tests__/BaseFieldLayout.test.js: -------------------------------------------------------------------------------- 1 | import renderer from 'react-test-renderer'; 2 | import { shallow, mount } from 'enzyme'; 3 | import TestBaseFieldLayout from '../BaseFieldLayout'; 4 | 5 | const defaultProps = { 6 | meta: { 7 | touched: null, 8 | error: null 9 | }, 10 | input: { 11 | name: 'field-name' 12 | }, 13 | inputComponent: () => { return 'test case'; } 14 | }, 15 | BaseFieldLayout = (props) => ; 16 | 17 | describe('Render BaseFieldLayout', () => { 18 | it('render correctly BaseFieldLayout component', () => { 19 | const BaseFieldLayoutComponent = renderer.create().toJSON(); 20 | expect(BaseFieldLayoutComponent).toMatchSnapshot(); 21 | }); 22 | 23 | it('render correctly icon prop', () => { 24 | const props = { 25 | icon: 26 | }, 27 | BaseFieldLayoutComponent = mount(); 28 | expect(BaseFieldLayoutComponent.find('span').hasClass('icon-exclamation')).toBeTruthy(); 29 | }); 30 | 31 | it('check label prop is rendered correctly', () => { 32 | const props = { 33 | label: 'custom label' 34 | }, 35 | BaseFieldLayoutComponent = mount(); 36 | expect(BaseFieldLayoutComponent.find('span').hasClass('control-label-title')).toBeTruthy(); 37 | }); 38 | 39 | it('render correctly labelTooltipContent prop', () => { 40 | const props = { 41 | labelTooltipContent: 'tooltip for label' 42 | }, 43 | BaseFieldLayoutComponent = mount(); 44 | expect(BaseFieldLayoutComponent.find('span').hasClass('tooltip-icon')).toBeTruthy(); 45 | }); 46 | 47 | describe('render correctly fieldLink', () => { 48 | const props = { 49 | fieldLink: 50 | }; 51 | 52 | it('check prop is null by default', () => { 53 | const BaseFieldLayoutComponent = shallow(); 54 | expect(BaseFieldLayoutComponent.props().fieldLink).toBe(null); 55 | }); 56 | 57 | it('check prop is rendered with defined link', () => { 58 | const BaseFieldLayoutComponent = mount(); 59 | expect(BaseFieldLayoutComponent.contains(props.fieldLink)).toBeTruthy(); 60 | }); 61 | }); 62 | 63 | it('render correctly prefix prop', () => { 64 | const props = { 65 | prefix: 'CHF' 66 | }, 67 | BaseFieldLayoutComponent = mount(); 68 | expect(BaseFieldLayoutComponent.find('span').hasClass('control-prefix')).toBeTruthy(); 69 | }); 70 | 71 | it('render correctly tooltipContent prop', () => { 72 | const props = { 73 | tooltipContent: 'tooltip for field' 74 | }, 75 | BaseFieldLayoutComponent = mount(); 76 | expect(BaseFieldLayoutComponent.find('span').hasClass('tooltip-icon')).toBeTruthy(); 77 | }); 78 | 79 | it('render correctly required prop', () => { 80 | const props = { 81 | label: 'custom label', 82 | required: true 83 | }, 84 | BaseFieldLayoutComponent = mount(); 85 | expect(BaseFieldLayoutComponent.find('.control-asterisk').length).toEqual(1); 86 | }); 87 | 88 | describe('render correctly className', () => { 89 | const props = { 90 | className: 'custom-class' 91 | }; 92 | 93 | it('check prop is empty by default', () => { 94 | const BaseFieldLayoutComponent = mount(); 95 | expect(BaseFieldLayoutComponent.find('label').hasClass(props.className)).toBeFalsy(); 96 | }); 97 | 98 | it('check prop is rendered', () => { 99 | const BaseFieldLayoutComponent = mount(); 100 | expect(BaseFieldLayoutComponent.find('label').hasClass(props.className)).toBeTruthy(); 101 | }); 102 | }); 103 | 104 | it('render correctly isMultiple prop', () => { 105 | const props = { 106 | isMultiple: true 107 | }, 108 | BaseFieldLayoutComponent = mount(); 109 | expect(BaseFieldLayoutComponent.find('div').at(0).hasClass('multi-select-wrap')).toBeTruthy(); 110 | }); 111 | 112 | it('check if field has error', () => { 113 | const props = { 114 | meta: { 115 | touched: true, 116 | error: 'This field is required' 117 | } 118 | }, 119 | BaseFieldLayoutComponent = mount(); 120 | expect(BaseFieldLayoutComponent.find('.error')).toHaveLength(1); 121 | }); 122 | }); 123 | -------------------------------------------------------------------------------- /shared/forms/fields/__tests__/__snapshots__/BaseFieldLayout.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Render BaseFieldLayout render correctly BaseFieldLayout component 1`] = ` 4 |
7 |
21 | `; 22 | -------------------------------------------------------------------------------- /shared/forms/inputs/DateInput.js: -------------------------------------------------------------------------------- 1 | import DatePicker from 'react-datepicker'; 2 | import PropTypes from 'prop-types'; 3 | import valueToDate from 'shared/utils/valueToDate'; 4 | import dateToValue from 'shared/utils/dateToValue'; 5 | import moment from 'moment'; 6 | 7 | const propTypes = { 8 | inputClassName: PropTypes.string, 9 | monthsShown: PropTypes.number, 10 | placeholder: PropTypes.string, 11 | disabled: PropTypes.bool, 12 | name: PropTypes.string, 13 | dateFormat: PropTypes.string, 14 | value: PropTypes.string, 15 | showMonthYearsDropdowns: PropTypes.bool, 16 | minDate: PropTypes.object 17 | }, 18 | defaultProps = { 19 | inputClassName: 'input-custom', 20 | monthsShown: 1, 21 | dateFormat: 'DD.MM.YYYY', 22 | showMonthYearsDropdowns: false, 23 | minDate: moment() 24 | }; 25 | 26 | export default function DateInput(props) { 27 | const { 28 | inputClassName, 29 | monthsShown, 30 | placeholder, 31 | disabled, 32 | name, 33 | value, 34 | dateFormat, 35 | onBlur, 36 | showMonthYearsDropdowns, 37 | minDate 38 | } = props; 39 | return ( 40 |
41 | props.onChange(dateToValue(value, dateFormat))} 46 | onBlur={onBlur} 47 | disabled={disabled} 48 | className={inputClassName} 49 | dateFormat={dateFormat} 50 | monthsShown={monthsShown} 51 | placeholderText={placeholder} 52 | showYearDropdown={showMonthYearsDropdowns} 53 | showMonthDropdown={showMonthYearsDropdowns} 54 | dropdownMode="select" 55 | minDate={minDate} 56 | /> 57 |
58 | ); 59 | } 60 | 61 | DateInput.propTypes = propTypes; 62 | DateInput.defaultProps = defaultProps; 63 | -------------------------------------------------------------------------------- /shared/forms/inputs/__tests__/DateInput.test.js: -------------------------------------------------------------------------------- 1 | import renderer from 'react-test-renderer'; 2 | import { mount } from 'enzyme'; 3 | import TestDateInput from '../DateInput'; 4 | 5 | const moment = require.requireActual('moment-timezone').tz.setDefault('America/Los_Angeles'), 6 | defaultProps = { 7 | minDate: moment(0) 8 | }, 9 | DateInput = (props) => 10 | ; 14 | 15 | describe('Render DateInput', () => { 16 | it('render correctly date component', () => { 17 | const DateInputComponent = renderer.create().toJSON(); 18 | expect(DateInputComponent).toMatchSnapshot(); 19 | }); 20 | 21 | it('render date input correctly with empty value', () => { 22 | const props = { 23 | value: null 24 | }, 25 | DateInputComponent = mount(); 26 | expect((DateInputComponent).prop('value')).toEqual(null); 27 | }); 28 | 29 | it('check the onChange callback', () => { 30 | const onChange = jest.fn(), 31 | props = { 32 | value: '20.01.2018', 33 | onChange 34 | }, 35 | DateInputComponent = mount().find('input'); 36 | DateInputComponent.simulate('change', { target: {value: moment('2018-01-22')} }); 37 | expect(onChange).toHaveBeenCalledWith('22.01.2018'); 38 | }); 39 | 40 | it('check the type of value', () => { 41 | const props = { 42 | value: '10.03.2018' 43 | }, 44 | DateInputComponent = mount(); 45 | expect(DateInputComponent.prop('value')).toBeString(); 46 | }); 47 | 48 | it('check DatePicker popup open', () => { 49 | const DateComponent = mount(), 50 | dateInput = DateComponent.find("input[type='text']"); 51 | dateInput.simulate('click'); 52 | expect(DateComponent.find('.react-datepicker')).toHaveLength(1); 53 | }); 54 | 55 | it('check month and years dropdowns displayed', () => { 56 | const props = { 57 | showMonthYearsDropdowns: true 58 | }, 59 | DateInputComponent = mount().find('.datepicker'); 60 | expect(DateInputComponent.hasClass('react-datepicker-hide-month')).toEqual(true); 61 | }); 62 | }); 63 | -------------------------------------------------------------------------------- /shared/forms/inputs/__tests__/__snapshots__/DateInput.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Render DateInput render correctly date component 1`] = ` 4 |
7 |
8 |
11 |
14 | 34 |
35 |
36 |
37 |
38 | `; 39 | -------------------------------------------------------------------------------- /shared/hoc/BaseFieldHOC.js: -------------------------------------------------------------------------------- 1 | import { Field } from 'redux-form'; 2 | import BaseFieldLayout from './BaseFieldLayout'; 3 | 4 | export default function BaseFieldHOC(Component) { 5 | return function(props) { 6 | return ( 7 | 12 | ); 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /shared/hoc/__tests__/BaseFieldHOC.test.js: -------------------------------------------------------------------------------- 1 | import renderer from 'react-test-renderer'; 2 | import BaseFieldHOC from '../BaseFieldHOC'; 3 | 4 | import { reduxForm } from 'redux-form'; 5 | import { createStore } from 'redux'; 6 | import { Provider } from 'react-redux'; 7 | 8 | describe('Render BaseFieldHOC', () => { 9 | const store = createStore(() => ({})); 10 | let BaseFieldHOCComponent; 11 | 12 | beforeEach(() => { 13 | const TextInput = () => { return 'text input'; }, 14 | BaseFieldHOCWrapper = BaseFieldHOC(TextInput), 15 | TextField = reduxForm({ form: 'testForm' })(BaseFieldHOCWrapper); 16 | BaseFieldHOCComponent = renderer.create( 17 | 18 | 19 | 20 | ).toJSON(); 21 | }); 22 | 23 | it('render correctly component', () => { 24 | expect(BaseFieldHOCComponent).toMatchSnapshot(); 25 | }); 26 | 27 | it('check input component is wrapped in BaseFieldLayout', () => { 28 | expect(BaseFieldHOCComponent.props.className).toEqual('form-group'); 29 | }); 30 | }); 31 | -------------------------------------------------------------------------------- /shared/hoc/__tests__/__snapshots__/BaseFieldHOC.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Render BaseFieldHOC render correctly component 1`] = ` 4 |
7 |
21 | `; 22 | -------------------------------------------------------------------------------- /shared/modals/ModalTrigger.js: -------------------------------------------------------------------------------- 1 | import { autobind } from 'core-decorators'; 2 | import PropTypes from 'prop-types'; 3 | import { Component, Children, cloneElement } from 'react'; 4 | 5 | import ModalWrapper from './ModalWrapper'; 6 | 7 | const propTypes = { 8 | children: PropTypes.object 9 | }; 10 | 11 | export default class ModalTrigger extends Component { 12 | state = { 13 | toggled: false 14 | } 15 | 16 | @autobind 17 | open(e) { 18 | e.stopPropagation(); 19 | e.preventDefault(); 20 | this.setState({ toggled: true }); 21 | } 22 | 23 | @autobind 24 | close() { 25 | this.setState({ toggled: false }); 26 | } 27 | 28 | render() { 29 | const { children } = this.props; 30 | 31 | // ensure that we have only one child (control element) 32 | let child = cloneElement(Children.only(children), { onClick: this.open, key: 'modal-control' }); 33 | return [ 34 | child, 35 | 36 | ]; 37 | } 38 | } 39 | 40 | ModalTrigger.propTypes = propTypes; 41 | -------------------------------------------------------------------------------- /shared/modals/ModalWrapper.js: -------------------------------------------------------------------------------- 1 | import PropTypes from 'prop-types'; 2 | import { Modal } from 'react-bootstrap'; 3 | 4 | const propTypes = { 5 | modalClassName: PropTypes.string, 6 | title: PropTypes.string, 7 | show: PropTypes.bool, 8 | onHide: PropTypes.func, 9 | component: PropTypes.func 10 | }; 11 | 12 | export default function ModalWrapper(props) { 13 | const { 14 | modalClassName, 15 | title, 16 | show, 17 | onHide, 18 | component: ModalComponent 19 | } = props; 20 | 21 | return ( 22 | 23 |
24 | 25 | {title} 26 |
27 |
28 | 29 | {ModalComponent && } 30 | 31 |
32 |
33 | ); 34 | } 35 | 36 | ModalWrapper.propTypes = propTypes; 37 | -------------------------------------------------------------------------------- /shared/modals/__tests__/ModalTrigger.test.js: -------------------------------------------------------------------------------- 1 | import { shallow, mount } from 'enzyme'; 2 | import ModalTrigger from '../ModalTrigger'; 3 | 4 | describe('Render ModalTrigger', () => { 5 | it('render component correctly', () => { 6 | const ModalTriggerComponent = shallow(
); 7 | expect(ModalTriggerComponent).toMatchSnapshot(); 8 | }); 9 | 10 | describe('props and state behaviour', () => { 11 | const ModalTriggerComponent = mount(
); 12 | 13 | it('ensure to have only one child (control element)', () => { 14 | expect(ModalTriggerComponent.findWhere(node => node.key() === 'modal-control').length).toEqual(1); 15 | }); 16 | 17 | it('check children prop type', () => { 18 | expect(ModalTriggerComponent.props().children).toBeObject(); 19 | }); 20 | 21 | it('check the modal is opened', () => { 22 | const event = { 23 | preventDefault: () => {}, 24 | stopPropagation: () => {} 25 | }; 26 | ModalTriggerComponent.instance().open(event); 27 | expect(ModalTriggerComponent.state().toggled).toBeTruthy(); 28 | }); 29 | 30 | it('check the modal is closed', () => { 31 | ModalTriggerComponent.instance().close(); 32 | expect(ModalTriggerComponent.state().toggled).toBeFalsy(); 33 | }); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /shared/modals/__tests__/ModalWrapper.test.js: -------------------------------------------------------------------------------- 1 | import { shallow, mount } from 'enzyme'; 2 | import ModalWrapper from '../ModalWrapper'; 3 | 4 | describe('Render ModalWrapper', () => { 5 | it('without component', () => { 6 | const ModalWrapperComponent = shallow(); 7 | expect(ModalWrapperComponent).toMatchSnapshot(); 8 | }); 9 | 10 | it('with component', () => { 11 | const props = { 12 | component: () => {} 13 | }, 14 | ModalWrapperComponent = shallow(); 15 | expect(ModalWrapperComponent).toMatchSnapshot(); 16 | }); 17 | 18 | it('render correct class name', () => { 19 | const props = { 20 | modalClassName: 'custom-class-name' 21 | }, 22 | ModalWrapperComponent = shallow().find('Modal'); 23 | expect(ModalWrapperComponent.hasClass('custom-class-name')).toEqual(true); 24 | }); 25 | 26 | it('render correct title', () => { 27 | const props = { 28 | title: 'Modal Title' 29 | }, 30 | ModalWrapperComponent = shallow().find('ModalTitle'); 31 | expect(ModalWrapperComponent.props().children).toEqual('Modal Title'); 32 | }); 33 | 34 | describe('render correct show prop', () => { 35 | const props = { 36 | show: true 37 | }, 38 | ModalWrapperComponent = shallow().find('Modal'); 39 | 40 | it('check prop type', () => { 41 | expect(ModalWrapperComponent.props().show).toBeBoolean(); 42 | }); 43 | 44 | it('check prop value', () => { 45 | expect(ModalWrapperComponent.props().show).toEqual(true); 46 | }); 47 | }); 48 | 49 | it('render correct onHide prop type', () => { 50 | const props = { 51 | onHide: () => {} 52 | }, 53 | ModalWrapperComponent = shallow().find('Modal'); 54 | expect(ModalWrapperComponent.props().onHide).toBeFunction(); 55 | }); 56 | 57 | it('render correct component prop type', () => { 58 | const props = { 59 | component: () => {} 60 | }, 61 | ModalWrapperComponent = mount(); 62 | expect(ModalWrapperComponent.props().component).toBeFunction(); 63 | }); 64 | }); 65 | -------------------------------------------------------------------------------- /shared/modals/__tests__/__snapshots__/ModalTrigger.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Render ModalTrigger render component correctly 1`] = ` 4 | Array [ 5 |
, 9 | , 14 | ] 15 | `; 16 | -------------------------------------------------------------------------------- /shared/modals/__tests__/__snapshots__/ModalWrapper.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Render ModalWrapper with component 1`] = ` 4 | 29 |
32 | 37 | 41 |
44 | ✕ 45 |
46 |
47 | 51 | 54 | 55 |
56 |
57 | `; 58 | 59 | exports[`Render ModalWrapper without component 1`] = ` 60 | 85 |
88 | 93 | 97 |
100 | ✕ 101 |
102 |
103 | 107 |
108 |
109 | `; 110 | -------------------------------------------------------------------------------- /shared/utils/__tests__/valueToDate.test.js: -------------------------------------------------------------------------------- 1 | import valueToDate from '../valueToDate'; 2 | 3 | const moment = require.requireActual('moment-timezone').tz.setDefault('Europe/Kiev'); 4 | 5 | describe('Render valueToDate util', () => { 6 | const date = '21.11.2015', 7 | format = 'DD.MM.YYYY'; 8 | 9 | it('with null value', () => { 10 | const value = valueToDate('', format); 11 | expect(value).toEqual(null); 12 | }); 13 | 14 | it('with defined value', () => { 15 | const value = valueToDate(date, format); 16 | expect(value).toEqual(moment(date, format)); 17 | }); 18 | 19 | it('check value is instanceof moment', () => { 20 | const value = valueToDate(date, format); 21 | expect(value instanceof moment).toBeTruthy(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /shared/utils/valueToDate.js: -------------------------------------------------------------------------------- 1 | import moment from 'moment'; 2 | 3 | export default function valueToDate(value, dateFormat) { 4 | if (!value) { 5 | return null; 6 | } 7 | return moment(value, dateFormat); 8 | } 9 | -------------------------------------------------------------------------------- /shared/widgets/Spinner.js: -------------------------------------------------------------------------------- 1 | import PropTypes from 'prop-types'; 2 | import withPortalHOC from 'shared/hoc/withPortalHOC'; 3 | import rawMarkup from 'shared/utils/rawMarkup'; 4 | import Loader from 'shared/widgets/Loader'; 5 | 6 | const propTypes = { 7 | title: PropTypes.oneOfType([ 8 | PropTypes.string, 9 | PropTypes.element 10 | ]), 11 | subTitle: PropTypes.string 12 | }, defaultProps = { 13 | title: gettext('Please wait') 14 | }; 15 | 16 | function Spinner(props) { 17 | const { 18 | title, 19 | subTitle 20 | } = props; 21 | return ( 22 |
23 |
 
24 |
25 |

26 | {subTitle &&

{subTitle}

} 27 | 28 |
29 |
30 | ); 31 | } 32 | 33 | export default withPortalHOC(Spinner); 34 | 35 | Spinner.propTypes = propTypes; 36 | Spinner.defaultProps = defaultProps; 37 | -------------------------------------------------------------------------------- /shared/widgets/__tests__/Spinner.test.js: -------------------------------------------------------------------------------- 1 | import { mount } from 'enzyme'; 2 | import Spinner from '../Spinner'; 3 | 4 | describe('Render Spinner', () => { 5 | it('render correctly Spinner component', () => { 6 | const SpinnerComponent = mount(); 7 | expect(SpinnerComponent).toMatchSnapshot(); 8 | }); 9 | 10 | it('check prop title by default', () => { 11 | const SpinnerComponent = mount(); 12 | expect(SpinnerComponent.find('p').text()).toEqual('Please wait'); 13 | }); 14 | 15 | it('check prop type for title is string', () => { 16 | const props = { 17 | title: 'Wait' 18 | }, 19 | SpinnerComponent = mount(); 20 | expect(SpinnerComponent.find('p').text()).toBeString(); 21 | }); 22 | 23 | it('check prop title with html tags', () => { 24 | const props = { 25 | title: 'Please wait' 26 | }, 27 | SpinnerComponent = mount(); 28 | expect(SpinnerComponent.find('p').text()).toEqual('Please wait'); 29 | }); 30 | 31 | describe('check prop subTitle', () => { 32 | const props = { 33 | subTitle: 'left 1 minute' 34 | }, 35 | SpinnerComponent = mount(); 36 | 37 | it('type for subTitle is string', () => { 38 | expect(SpinnerComponent.find('p').at(1).text()).toBeString(); 39 | }); 40 | 41 | it('render correct text', () => { 42 | expect(SpinnerComponent.find('p').at(1).text()).toEqual(props.subTitle); 43 | }); 44 | }); 45 | 46 | it('check subTitle is not rendered', () => { 47 | const SpinnerComponent = mount(); 48 | expect(SpinnerComponent.find('p').length).toEqual(1); 49 | }); 50 | }); 51 | -------------------------------------------------------------------------------- /shared/widgets/__tests__/__snapshots__/Spinner.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Render Spinner render correctly Spinner component 1`] = ` 4 | <_class> 5 | 8 |
11 |
14 |   15 |
16 |
19 |

26 | 29 |

32 | 35 | 38 | 41 | 44 | 47 | 50 | 53 | 56 |
57 | 58 |
59 |
60 |
61 | 62 | `; 63 | --------------------------------------------------------------------------------