diff --git a/src/core/ReactCompositeComponent.js b/src/core/ReactCompositeComponent.js index 66787bd36d..8f2a04a4dc 100644 --- a/src/core/ReactCompositeComponent.js +++ b/src/core/ReactCompositeComponent.js @@ -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 - ); + )); } }, diff --git a/src/core/__tests__/ReactCompositeComponentError-test.js b/src/core/__tests__/ReactCompositeComponentError-test.js index 11cdd96671..a113324901 100644 --- a/src/core/__tests__/ReactCompositeComponentError-test.js +++ b/src/core/__tests__/ReactCompositeComponentError-test.js @@ -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 = ; - ReactTestUtils.renderIntoDocument(instance); - expect(ReactErrorUtils.guard.mock.calls[0][1]) - .toEqual('Component.someHandler'); + var instance = ; + ReactTestUtils.renderIntoDocument(instance); + expect(ReactErrorUtils.guard.mostRecentCall.args[1]) + .toEqual('Component.someHandler'); }); });