The library for web and native user interfaces.
Add unit test to prevent regression
The original autobinding diff made some assumptions about how methods were called on components that had to be reverted. This diff enforces those assumptions in a test
CommitSyncScript committed
Jun 24, 2013 at 16:09 UTC
7c60bb3e548980f3636190ecf08392d9f26aebb5
1 file changed
+8
src/core/__tests__/ReactCompositeComponent-test.js
+8
@@ -188,6 +188,14 @@ describe('ReactCompositeComponent', function() {
188
});
189
var instance = <ComponentClass />;
190
191
+ // These are controversial assertions for now, they just exist
192
+ // because existing code depends on these assumptions.
193
+ expect(function() {
194
+ instance.methodToBeExplicitlyBound.bind(instance)();
195
+ }).not.toThrow();
196
+ expect(function() {
197
+ instance.methodAutoBound();
198
+ }).not.toThrow();
199
expect(function() {
200
instance.methodExplicitlyNotBound();
201
}).not.toThrow();