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.
Brian Kim committed
Nov 13, 2013 at 05:07 UTC
e707ec0b1ecc61634062e9911eaf974958a449a9
2 files changed
+9
-12
src/core/ReactCompositeComponent.js
+3
-3
@@ -878,10 +878,10 @@ var ReactCompositeComponentMixin = {
878
continue;
879
}
880
var method = this.__reactAutoBindMap[autoBindKey];
881
- this[autoBindKey] = ReactErrorUtils.guard(
882
- this._bindAutoBindMethod(method),
881
+ this[autoBindKey] = this._bindAutoBindMethod(ReactErrorUtils.guard(
882
+ method,
883
this.constructor.displayName + '.' + autoBindKey
884
- );
884
+ ));
885
}
886
},
887
src/core/__tests__/ReactCompositeComponentError-test.js
+6
-9
@@ -21,15 +21,12 @@
21
22
var React = require('React');
23
var ReactTestUtils = require('ReactTestUtils');
24
-var ReactErrorUtils;
24
+var ReactErrorUtils = require('ReactErrorUtils');
25
26
describe('ReactCompositeComponent-error', function() {
27
28
- beforeEach(function() {
29
- ReactErrorUtils = require('ReactErrorUtils');
30
- });
31
-
28
it('should be passed the component and method name', function() {
29
+ spyOn(ReactErrorUtils, 'guard');
30
var Component = React.createClass({
31
someHandler: function() {},
32
render: function() {
@@ -37,10 +34,10 @@ describe('ReactCompositeComponent-error', function() {
34
}
35
});
36
40
- var instance = <Component />;
41
- ReactTestUtils.renderIntoDocument(instance);
42
- expect(ReactErrorUtils.guard.mock.calls[0][1])
43
- .toEqual('Component.someHandler');
37
+ var instance = <Component />;
38
+ ReactTestUtils.renderIntoDocument(instance);
39
+ expect(ReactErrorUtils.guard.mostRecentCall.args[1])
40
+ .toEqual('Component.someHandler');
41
});
42
43
});