From 7c60bb3e548980f3636190ecf08392d9f26aebb5 Mon Sep 17 00:00:00 2001 From: CommitSyncScript Date: Mon, 24 Jun 2013 16:09:38 -0700 Subject: [PATCH] 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 --- src/core/__tests__/ReactCompositeComponent-test.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/__tests__/ReactCompositeComponent-test.js b/src/core/__tests__/ReactCompositeComponent-test.js index ee48a4bcb1..6bfd0b03d5 100644 --- a/src/core/__tests__/ReactCompositeComponent-test.js +++ b/src/core/__tests__/ReactCompositeComponent-test.js @@ -188,6 +188,14 @@ describe('ReactCompositeComponent', function() { }); var instance = ; + // These are controversial assertions for now, they just exist + // because existing code depends on these assumptions. + expect(function() { + instance.methodToBeExplicitlyBound.bind(instance)(); + }).not.toThrow(); + expect(function() { + instance.methodAutoBound(); + }).not.toThrow(); expect(function() { instance.methodExplicitlyNotBound(); }).not.toThrow();