add componentWillLeave and tests