From e707ec0b1ecc61634062e9911eaf974958a449a9 Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Wed, 13 Nov 2013 05:07:52 -0500 Subject: [PATCH] Fix failing tests Two of your tests were failing because of commit 1e71df5399e4c94511e587fa368e7c57a537dc91 I fixed them by: 1) Using jasmine's spyOn in ReactCompositeComponentError-test.js 2) Inverting the function wrapping in the above commit. Godspeed. --- src/core/ReactCompositeComponent.js | 6 +++--- .../ReactCompositeComponentError-test.js | 15 ++++++--------- 2 files changed, 9 insertions(+), 12 deletions(-) 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'); }); });