diff --git a/src/Breadcrumb.js b/src/Breadcrumb.js
index 1f45d11f8f..8e43efbc0b 100644
--- a/src/Breadcrumb.js
+++ b/src/Breadcrumb.js
@@ -32,7 +32,7 @@ const Breadcrumb = React.createClass({
},
renderBreadcrumbItem(child, index) {
- return cloneElement( child, { key: child.key ? child.key : index } );
+ return cloneElement(child, { key: child.key || index });
}
});
diff --git a/src/BreadcrumbItem.js b/src/BreadcrumbItem.js
index 82cf432692..84c374b6ca 100644
--- a/src/BreadcrumbItem.js
+++ b/src/BreadcrumbItem.js
@@ -1,6 +1,5 @@
import classNames from 'classnames';
import React from 'react';
-import warning from 'warning';
import SafeAnchor from './SafeAnchor';
@@ -56,8 +55,6 @@ const BreadcrumbItem = React.createClass({
target,
...props } = this.props;
- warning(!(href && active), '[react-bootstrap] `href` and `active` properties cannot be set at the same time');
-
const linkProps = {
href,
title,
diff --git a/test/BreadcrumbItemSpec.js b/test/BreadcrumbItemSpec.js
index 71320af04d..16a8fc5936 100644
--- a/test/BreadcrumbItemSpec.js
+++ b/test/BreadcrumbItemSpec.js
@@ -4,19 +4,7 @@ import ReactDOM from 'react-dom';
import BreadcrumbItem from '../src/BreadcrumbItem';
-import { shouldWarn } from './helpers';
-
describe('BreadcrumbItem', () => {
- it('Should warn if `active` and `href` attributes set', () => {
- ReactTestUtils.renderIntoDocument(
-
- Crumb
-
- );
-
- shouldWarn('[react-bootstrap] `href` and `active` properties cannot be set at the same time');
- });
-
it('Should render `a` as inner element when is not active', () => {
const instance = ReactTestUtils.renderIntoDocument(
@@ -28,7 +16,7 @@ describe('BreadcrumbItem', () => {
assert.notInclude(ReactDOM.findDOMNode(instance).className, 'active');
});
- it('Should add `active` class with `active` attribute set.', () => {
+ it('Should render `span.active` with `active` attribute set.', () => {
const instance = ReactTestUtils.renderIntoDocument(
Active Crumb
@@ -36,16 +24,23 @@ describe('BreadcrumbItem', () => {
);
assert.include(ReactDOM.findDOMNode(instance).className, 'active');
+ assert.ok(ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'span'));
});
- it('Should render `span` as inner element when is active', () => {
+ it('Should render `span.active` when active and has href', () => {
const instance = ReactTestUtils.renderIntoDocument(
-
- Crumb
+
+ Active Crumb
);
- assert.ok(ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'span'));
+ assert.include(ReactDOM.findDOMNode(instance).className, 'active');
+
+ const spanNode = ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'span');
+ assert.ok(spanNode);
+ assert.notOk(spanNode.hasAttribute('href'));
+
+ assert.lengthOf(ReactTestUtils.scryRenderedDOMComponentsWithTag(instance, 'a'), 0);
});
it('Should add custom classes onto `li` wrapper element', () => {