mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Remove references to React.autoBind
Cleaned up a comment and removed a useless test.
This commit is contained in:
committed by
Paul O’Shannessy
parent
e221ff7cd4
commit
cf83fbe397
@@ -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();
|
||||
* }
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user