From 42602a8922398901c4e29c1958993190f74e3249 Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Mon, 31 Aug 2015 11:32:01 -0700 Subject: [PATCH] Fix code style/grammar on synthetic event warning --- .../client/syntheticEvents/SyntheticEvent.js | 30 +++++++++++-------- .../__tests__/SyntheticEvent-test.js | 22 +++++++------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/renderers/dom/client/syntheticEvents/SyntheticEvent.js b/src/renderers/dom/client/syntheticEvents/SyntheticEvent.js index e54b04b317..9aac4fb1d8 100644 --- a/src/renderers/dom/client/syntheticEvents/SyntheticEvent.js +++ b/src/renderers/dom/client/syntheticEvents/SyntheticEvent.js @@ -91,14 +91,17 @@ assign(SyntheticEvent.prototype, { this.defaultPrevented = true; var event = this.nativeEvent; if (__DEV__) { - warning(event, - 'This Synthetic event is reused for performance reasons. If you\'re seeing this, ' + - 'you\'re calling `preventDefault` on a released/nullified Synthetic event. ' + - 'This is a no-op. See https://facebook.github.io/react/docs/events.html#event-pooling ' + - 'for more information.' + warning( + event, + 'This synthetic event is reused for performance reasons. If you\'re ' + + 'seeing this, you\'re calling `preventDefault` on a ' + + 'released/nullified synthetic event. This is a no-op. See ' + + 'https://fb.me/react-event-pooling for more information.' ); } - if (!event) return; + if (!event) { + return; + } if (event.preventDefault) { event.preventDefault(); @@ -111,14 +114,17 @@ assign(SyntheticEvent.prototype, { stopPropagation: function() { var event = this.nativeEvent; if (__DEV__) { - warning(event, - 'This Synthetic event is reused for performance reasons. If you\'re seeing this, ' + - 'you\'re calling `stopPropagation` on a released/nullified Synthetic event. ' + - 'This is a no-op. See https://facebook.github.io/react/docs/events.html#event-pooling ' + - 'for more information.' + warning( + event, + 'This synthetic event is reused for performance reasons. If you\'re ' + + 'seeing this, you\'re calling `stopPropagation` on a ' + + 'released/nullified synthetic event. This is a no-op. See ' + + 'https://fb.me/react-event-pooling for more information.' ); } - if (!event) return; + if (!event) { + return; + } if (event.stopPropagation) { event.stopPropagation(); diff --git a/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticEvent-test.js b/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticEvent-test.js index d2912d66ed..02803e6cdc 100644 --- a/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticEvent-test.js +++ b/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticEvent-test.js @@ -72,33 +72,31 @@ describe('SyntheticEvent', function() { expect(syntheticEvent.isPersistent()).toBe(true); }); - it('should warn if the Synthetic event has been released when calling `preventDefault`', function() { + it('should warn if the synthetic event has been released when calling `preventDefault`', function() { spyOn(console, 'error'); var syntheticEvent = createEvent({}); SyntheticEvent.release(syntheticEvent); syntheticEvent.preventDefault(); expect(console.error.calls.length).toBe(1); expect(console.error.argsForCall[0][0]).toBe( - 'Warning: ' + - 'This Synthetic event is reused for performance reasons. If you\'re seeing this, ' + - 'you\'re calling `preventDefault` on a released/nullified Synthetic event. ' + - 'This is a no-op. See https://facebook.github.io/react/docs/events.html#event-pooling ' + - 'for more information.' + 'Warning: This synthetic event is reused for performance reasons. If ' + + 'you\'re seeing this, you\'re calling `preventDefault` on a ' + + 'released/nullified synthetic event. This is a no-op. See ' + + 'https://fb.me/react-event-pooling for more information.' ); }); - it('should warn if the Synthetic event has been released when calling `stopPropagation`', function() { + it('should warn if the synthetic event has been released when calling `stopPropagation`', function() { spyOn(console, 'error'); var syntheticEvent = createEvent({}); SyntheticEvent.release(syntheticEvent); syntheticEvent.stopPropagation(); expect(console.error.calls.length).toBe(1); expect(console.error.argsForCall[0][0]).toBe( - 'Warning: ' + - 'This Synthetic event is reused for performance reasons. If you\'re seeing this, ' + - 'you\'re calling `stopPropagation` on a released/nullified Synthetic event. ' + - 'This is a no-op. See https://facebook.github.io/react/docs/events.html#event-pooling ' + - 'for more information.' + 'Warning: This synthetic event is reused for performance reasons. If ' + + 'you\'re seeing this, you\'re calling `stopPropagation` on a ' + + 'released/nullified synthetic event. This is a no-op. See ' + + 'https://fb.me/react-event-pooling for more information.' ); }); });