@samitouri / QOS-React-2 / commits / 8f4c2997a0

add test to show `this` is indeed undefined - closes #3613

Joshua Evans committed Oct 9, 2015 at 19:37 UTC 8f4c2997a028e0908bc85d4cfa3d8b97c47f3fb8
1 file changed +11
src/renderers/dom/client/wrappers/__tests__/ReactDOMInput-test.js
+11
@@ -279,6 +279,17 @@ describe('ReactDOMInput', function() {
279 expect(console.error.argsForCall.length).toBe(1);
280 });
281
282 + it('should have a this value of undefined if bind is not used', function() {
283 + var unboundInputOnChange = function() {
284 + expect(this).toBe(undefined);
285 + };
286 +
287 + var instance = <input type="text" onChange={unboundInputOnChange} />;
288 + instance = ReactTestUtils.renderIntoDocument(instance);
289 +
290 + ReactTestUtils.Simulate.change(instance);
291 + });
292 +
293 it('should throw if both value and valueLink are provided', function() {
294 var node = document.createElement('div');
295 var link = new ReactLink('yolo', mocks.getMockFunction());