Remove references to React.autoBind

Cleaned up a comment and removed a useless test.
This commit is contained in:
Paul O'Shannessy
2013-07-11 23:07:01 -07:00
committed by Paul O’Shannessy
parent e221ff7cd4
commit cf83fbe397
3 changed files with 3 additions and 38 deletions
+2 -2
View File
@@ -37,9 +37,9 @@ var invariant = require('invariant');
* </div>
* );
* },
* handleClick: React.autoBind(function() {
* handleClick: function() {
* this.refs.custom.handleClick();
* }),
* },
* componentDidMount: function() {
* this.refs.custom.initialize();
* }
+1 -1
View File
@@ -26,7 +26,7 @@ var ReactTestUtils = require('ReactTestUtils');
var reactComponentExpect = require('reactComponentExpect');
// TODO: Test render and all stock methods.
describe('React.autoBind', function() {
describe('autobinding', function() {
it('Holds reference to instance', function() {
@@ -20,7 +20,6 @@
"use strict";
var MorphingComponent;
var MorphingAutoBindComponent;
var ChildUpdates;
var React;
var ReactCurrentOwner;
@@ -61,22 +60,6 @@ describe('ReactCompositeComponent', function() {
}
});
MorphingAutoBindComponent = React.createClass({
getInitialState: function() {
return {activated: false};
},
_toggleActivatedState:function() {
this.setState({activated: !this.state.activated});
},
render: function() {
return !this.state.activated ?
<a ref="x" onClick={this._toggleActivatedState} /> :
<b ref="x" onClick={this._toggleActivatedState} />;
}
});
/**
* We'll use this to ensure that an old version is not cached when it is
* reallocated again.
@@ -138,24 +121,6 @@ describe('ReactCompositeComponent', function() {
reactComponentExpect(instance.refs.x).toBeDOMComponentWithTag('a');
});
it('should behave the same with React.autoBind', function() {
var instance = <MorphingAutoBindComponent />;
ReactTestUtils.renderIntoDocument(instance);
reactComponentExpect(instance)
.expectRenderedChild()
.toBeDOMComponentWithTag('a');
var renderedChild = reactComponentExpect(instance)
.expectRenderedChild()
.instance();
ReactTestUtils.Simulate.click(renderedChild);
reactComponentExpect(instance)
.expectRenderedChild()
.toBeDOMComponentWithTag('b');
});
it('should not cache old DOM nodes when switching constructors', function() {
var instance = <ChildUpdates renderAnchor={true} anchorClassOn={false}/>;
ReactTestUtils.renderIntoDocument(instance);