Fix failing tests

Two of your tests were failing because of commit
1e71df5399
I fixed them by:
1) Using jasmine's spyOn in ReactCompositeComponentError-test.js
2) Inverting the function wrapping in the above commit.
Godspeed.
This commit is contained in:
Brian Kim 2013-11-13 05:07:52 -05:00
parent 9fd28f44df
commit e707ec0b1e
2 changed files with 9 additions and 12 deletions

View File

@ -878,10 +878,10 @@ var ReactCompositeComponentMixin = {
continue;
}
var method = this.__reactAutoBindMap[autoBindKey];
this[autoBindKey] = ReactErrorUtils.guard(
this._bindAutoBindMethod(method),
this[autoBindKey] = this._bindAutoBindMethod(ReactErrorUtils.guard(
method,
this.constructor.displayName + '.' + autoBindKey
);
));
}
},

View File

@ -21,15 +21,12 @@
var React = require('React');
var ReactTestUtils = require('ReactTestUtils');
var ReactErrorUtils;
var ReactErrorUtils = require('ReactErrorUtils');
describe('ReactCompositeComponent-error', function() {
beforeEach(function() {
ReactErrorUtils = require('ReactErrorUtils');
});
it('should be passed the component and method name', function() {
spyOn(ReactErrorUtils, 'guard');
var Component = React.createClass({
someHandler: function() {},
render: function() {
@ -37,10 +34,10 @@ describe('ReactCompositeComponent-error', function() {
}
});
var instance = <Component />;
ReactTestUtils.renderIntoDocument(instance);
expect(ReactErrorUtils.guard.mock.calls[0][1])
.toEqual('Component.someHandler');
var instance = <Component />;
ReactTestUtils.renderIntoDocument(instance);
expect(ReactErrorUtils.guard.mostRecentCall.args[1])
.toEqual('Component.someHandler');
});
});