Add some important getDOMNode tests back.

This commit is contained in:
cpojer
2015-03-10 17:27:19 -07:00
parent ae7da3aadd
commit 413e96d0cd
2 changed files with 14 additions and 0 deletions
@@ -586,6 +586,7 @@ describe('ReactDOMComponent', function() {
expect(
ReactBrowserEventEmitter.getListener(rootNodeID, 'onClick')
).toBe(callback);
expect(rootNode).toBe(instance.getDOMNode());
React.unmountComponentAtNode(container);
@@ -154,6 +154,7 @@ describe('ReactCompositeComponent', function() {
var anchor = instance.getAnchor();
var actualDOMAnchorNode = React.findDOMNode(anchor);
expect(actualDOMAnchorNode.className).toBe('');
expect(actualDOMAnchorNode).toBe(anchor.getDOMNode());
});
it('should auto bind methods and values correctly', function() {
@@ -926,11 +927,21 @@ describe('ReactCompositeComponent', function() {
expect(React.findDOMNode(comp.refs.static0).textContent).toBe('A');
expect(React.findDOMNode(comp.refs.static1).textContent).toBe('B');
expect(React.findDOMNode(comp.refs.static0))
.toBe(comp.refs.static0.getDOMNode());
expect(React.findDOMNode(comp.refs.static1))
.toBe(comp.refs.static1.getDOMNode());
// When flipping the order, the refs should update even though the actual
// contents do not
comp.setProps({flipped: true});
expect(React.findDOMNode(comp.refs.static0).textContent).toBe('B');
expect(React.findDOMNode(comp.refs.static1).textContent).toBe('A');
expect(React.findDOMNode(comp.refs.static0))
.toBe(comp.refs.static0.getDOMNode());
expect(React.findDOMNode(comp.refs.static1))
.toBe(comp.refs.static1.getDOMNode());
});
it('should allow access to findDOMNode in componentWillUnmount', function() {
@@ -939,9 +950,11 @@ describe('ReactCompositeComponent', function() {
var Component = React.createClass({
componentDidMount: function() {
a = React.findDOMNode(this);
expect(a).toBe(this.getDOMNode());
},
componentWillUnmount: function() {
b = React.findDOMNode(this);
expect(b).toBe(this.getDOMNode());
},
render: function() {
return <div />;