all files / components/ BreadCrumb.js

88.89% Statements 32/36
58.06% Branches 18/31
100% Functions 11/11
100% Lines 9/9
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 45 46 47 48                               19×       11×                                          
import React from 'react';IEE
import PropTypes from 'prop-types';
import { Link } from 'react-router';EIII
 
class BreadCrumb extends React.Component {
  componentDidMount() {
    // some logic here - we only test if the method is called
  }
  render() {
    return (
      <div className="page-intro background--gallery">
        <div className="wrapper">
          <div className="col-wrap">
            <div className="col">
              <nav>
                <div className="breadcrumb print--hide">
                  <ol className="breadcrumb__list">
                    {
                      this.props.breadCrumbItems.map((breadcrumb) => {
                        if (breadcrumb.link === '') {
                          return (<li key={breadcrumb.name} className="breadcrumb__item">
                            {breadcrumb.name}
                          </li>);
                        }
                        return (<li key={breadcrumb.name} className="breadcrumb__item">
                          <Link to={breadcrumb.link} style={{ cursor: 'pointer' }}>
                            {breadcrumb.name}
                          </Link>
                        </li>);
                      })
                    }
                  </ol>
                </div>
              </nav>
            </div>
          </div>
        </div>
      </div>
    );
  }
}
 
BreadCrumb.propTypes = {
  breadCrumbItems: PropTypes.array.isRequired,
};
 
export default BreadCrumb;