All files / src/components/item item.jsx

87.72% Statements 50/57
56.76% Branches 21/37
100% Functions 12/12
91.89% Lines 34/37
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44    1x     1x   1x   1x   1x   1x   1x   1x   1x   1x   1x   4x   76x   76x   1x   1x 1x     76x   76x     1x  
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
 
import styles from './item.less';
 
class Item extends Component {
  static displayName = 'ItemComponent';IEE
 
  static propTypes = {
    clickHandler: PropTypes.func.isRequired,
    description: PropTypes.string.isRequired,
    title: PropTypes.string.isRequired,
    dataTestId: PropTypes.string,
    isChecked: PropTypes.bool
  };
 
  /**
   * Render the Item component.
   *
   * @returns {React.Component} The rendered component.
   */
  render() {
    return (
      <div className={classnames(styles['preferences-body-item'])}>
        <label>
          <input
            type="checkbox"I
            data-test-id={this.props.dataTestId}
            onChange={this.props.clickHandler}I
            checked={this.props.isChecked} />
          <span>{this.props.title}</span>EI
        </label>
        <p>
          {this.props.description}
        </p>
      </div>
    );
  }
}
 
export default Item;
export { Item };