import React from 'react' import PropTypes from 'prop-types' import enzyme, { shallow, mount, render } from 'enzyme' import Adapter from 'enzyme-adapter-react-16' import { expect } from 'chai' import { BreadcrumbsProvider, Breadcrumbs, BreadcrumbsItem, breadcrumbsThroughArea as throughArea, } from '../index' import spec from './index.spec-set' enzyme.configure({ adapter: new Adapter() }); jest.dontMock('../index') class TestSimpleApp extends React.Component { static propTypes = { method: PropTypes.string, separator: PropTypes.node, renameProps: PropTypes.object, duplicateProps: PropTypes.object, onlyOneItem: PropTypes.bool, noAnyItem: PropTypes.bool, reactComponentInProps: PropTypes.bool, shouldBreadcrumbsUpdate: PropTypes.func, } state = { profileUrl: "/user/profile", haveProfile: true, replaceAnotherSame: false, } changeProfileUrl = () => { this.setState({profileUrl: "/user/settings"}) } restoreProfileUrl = () => { this.setState({profileUrl: "/user/profile"}) } removeProfile = () => { this.setState({haveProfile: false}) } replaceAnotherSame = () => { this.setState({replaceAnotherSame: true}) } render() { const onlyOneItem = this.props.noAnyItem || this.props.onlyOneItem const noFirstItem = this.props.noAnyItem const Home = this.props.reactComponentInProps ? Home Bold : 'Home' return ( { !noFirstItem ? ( this.state.replaceAnotherSame ? Home Another : {Home} ) : null } { !onlyOneItem ? User : null } { !onlyOneItem && this.state.haveProfile ? Profile : null } ) } } spec(TestSimpleApp)