From c822837eb2df6522958a2d234abec59883d37d82 Mon Sep 17 00:00:00 2001 From: Stefan Fisk Date: Tue, 24 Feb 2015 23:45:12 +0100 Subject: [PATCH] [removed] non-standard onClick props for ListGroup and ListGroupItem Old behaviour can be implemented using custom onClick handlers. --- src/ListGroup.jsx | 1 - src/ListGroupItem.jsx | 9 +-------- test/ListGroupItemSpec.jsx | 22 ---------------------- test/ListGroupSpec.jsx | 25 ------------------------- 4 files changed, 1 insertion(+), 56 deletions(-) diff --git a/src/ListGroup.jsx b/src/ListGroup.jsx index a61512f16b..8cc459323b 100644 --- a/src/ListGroup.jsx +++ b/src/ListGroup.jsx @@ -20,7 +20,6 @@ var ListGroup = React.createClass({ renderListItem: function (child, index) { return cloneWithProps(child, { - onClick: createChainedFunction(child.props.onClick, this.props.onClick), ref: child.ref, key: child.key ? child.key : index }); diff --git a/src/ListGroupItem.jsx b/src/ListGroupItem.jsx index 8579e2da80..6057a8c975 100644 --- a/src/ListGroupItem.jsx +++ b/src/ListGroupItem.jsx @@ -52,7 +52,7 @@ var ListGroupItem = React.createClass({ + > {this.props.header ? this.renderStructuredContent() : this.props.children} ); @@ -82,13 +82,6 @@ var ListGroupItem = React.createClass({ header: header, content: content }; - }, - - handleClick: function (e) { - if (this.props.onClick) { - e.preventDefault(); - this.props.onClick(this.props.eventKey, this.props.href, this.props.target); - } } }); diff --git a/test/ListGroupItemSpec.jsx b/test/ListGroupItemSpec.jsx index 8ba1a85c4b..828d193006 100644 --- a/test/ListGroupItemSpec.jsx +++ b/test/ListGroupItemSpec.jsx @@ -68,26 +68,4 @@ describe('ListGroupItem', function () { assert.ok(instance.getDOMNode().lastChild.className.match(/\blist-group-item-text\b/)); }); - it('Should call "onClick" when item is clicked', function (done) { - function handleClick(key, href) { - assert.equal(key, '2'); - assert.equal(href, "#link"); - done(); - } - var instance = ReactTestUtils.renderIntoDocument( - Item - ); - ReactTestUtils.Simulate.click(ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'a')); - }); - - it('Should call "onClick" with target attribute', function (done) { - function handleClick(key, href, target) { - assert.equal(target, '_blank'); - done(); - } - var instance = ReactTestUtils.renderIntoDocument( - Item - ); - ReactTestUtils.Simulate.click(ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'a')); - }); }); diff --git a/test/ListGroupSpec.jsx b/test/ListGroupSpec.jsx index c4f15f251e..2876e28d58 100644 --- a/test/ListGroupSpec.jsx +++ b/test/ListGroupSpec.jsx @@ -26,29 +26,4 @@ describe('ListGroup', function () { assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance.refs.child2, 'list-group-item')); }); - it('Should call "onClick" when child item is clicked', function (done) { - var item1Called = false, - item2Called = false; - function handleClick(key, href) { - if (key === 1) { - item1Called = true; - } else if (key === 2) { - item2Called = true; - } - if (item1Called && item2Called) { - done(); - } - } - var instance = ReactTestUtils.renderIntoDocument( - - Item 1 - Item 2 - Item 3 - - ); - ReactTestUtils.Simulate.click(ReactTestUtils.findRenderedDOMComponentWithTag(instance.refs.item3, 'a')); - ReactTestUtils.Simulate.click(ReactTestUtils.findRenderedDOMComponentWithTag(instance.refs.item2, 'a')); - ReactTestUtils.Simulate.click(ReactTestUtils.findRenderedDOMComponentWithTag(instance.refs.item1, 'a')); - }); - });