@samitouri / QOS-React / commits / 42602a8922

Fix code style/grammar on synthetic event warning

Ben Alpert committed Aug 31, 2015 at 11:32 UTC 42602a8922398901c4e29c1958993190f74e3249
2 files changed +28 -24
src/renderers/dom/client/syntheticEvents/SyntheticEvent.js
+18 -12
@@ -91,14 +91,17 @@ assign(SyntheticEvent.prototype, {
91 this.defaultPrevented = true;
92 var event = this.nativeEvent;
93 if (__DEV__) {
94 - warning(event,
95 - 'This Synthetic event is reused for performance reasons. If you\'re seeing this, ' +
96 - 'you\'re calling `preventDefault` on a released/nullified Synthetic event. ' +
97 - 'This is a no-op. See https://facebook.github.io/react/docs/events.html#event-pooling ' +
98 - 'for more information.'
94 + warning(
95 + event,
96 + 'This synthetic event is reused for performance reasons. If you\'re ' +
97 + 'seeing this, you\'re calling `preventDefault` on a ' +
98 + 'released/nullified synthetic event. This is a no-op. See ' +
99 + 'https://fb.me/react-event-pooling for more information.'
100 );
101 }
101 - if (!event) return;
102 + if (!event) {
103 + return;
104 + }
105
106 if (event.preventDefault) {
107 event.preventDefault();
@@ -111,14 +114,17 @@ assign(SyntheticEvent.prototype, {
114 stopPropagation: function() {
115 var event = this.nativeEvent;
116 if (__DEV__) {
114 - warning(event,
115 - 'This Synthetic event is reused for performance reasons. If you\'re seeing this, ' +
116 - 'you\'re calling `stopPropagation` on a released/nullified Synthetic event. ' +
117 - 'This is a no-op. See https://facebook.github.io/react/docs/events.html#event-pooling ' +
118 - 'for more information.'
117 + warning(
118 + event,
119 + 'This synthetic event is reused for performance reasons. If you\'re ' +
120 + 'seeing this, you\'re calling `stopPropagation` on a ' +
121 + 'released/nullified synthetic event. This is a no-op. See ' +
122 + 'https://fb.me/react-event-pooling for more information.'
123 );
124 }
121 - if (!event) return;
125 + if (!event) {
126 + return;
127 + }
128
129 if (event.stopPropagation) {
130 event.stopPropagation();
src/renderers/dom/client/syntheticEvents/__tests__/SyntheticEvent-test.js
+10 -12
@@ -72,33 +72,31 @@ describe('SyntheticEvent', function() {
72 expect(syntheticEvent.isPersistent()).toBe(true);
73 });
74
75 - it('should warn if the Synthetic event has been released when calling `preventDefault`', function() {
75 + it('should warn if the synthetic event has been released when calling `preventDefault`', function() {
76 spyOn(console, 'error');
77 var syntheticEvent = createEvent({});
78 SyntheticEvent.release(syntheticEvent);
79 syntheticEvent.preventDefault();
80 expect(console.error.calls.length).toBe(1);
81 expect(console.error.argsForCall[0][0]).toBe(
82 - 'Warning: ' +
83 - 'This Synthetic event is reused for performance reasons. If you\'re seeing this, ' +
84 - 'you\'re calling `preventDefault` on a released/nullified Synthetic event. ' +
85 - 'This is a no-op. See https://facebook.github.io/react/docs/events.html#event-pooling ' +
86 - 'for more information.'
82 + 'Warning: This synthetic event is reused for performance reasons. If ' +
83 + 'you\'re seeing this, you\'re calling `preventDefault` on a ' +
84 + 'released/nullified synthetic event. This is a no-op. See ' +
85 + 'https://fb.me/react-event-pooling for more information.'
86 );
87 });
88
90 - it('should warn if the Synthetic event has been released when calling `stopPropagation`', function() {
89 + it('should warn if the synthetic event has been released when calling `stopPropagation`', function() {
90 spyOn(console, 'error');
91 var syntheticEvent = createEvent({});
92 SyntheticEvent.release(syntheticEvent);
93 syntheticEvent.stopPropagation();
94 expect(console.error.calls.length).toBe(1);
95 expect(console.error.argsForCall[0][0]).toBe(
97 - 'Warning: ' +
98 - 'This Synthetic event is reused for performance reasons. If you\'re seeing this, ' +
99 - 'you\'re calling `stopPropagation` on a released/nullified Synthetic event. ' +
100 - 'This is a no-op. See https://facebook.github.io/react/docs/events.html#event-pooling ' +
101 - 'for more information.'
96 + 'Warning: This synthetic event is reused for performance reasons. If ' +
97 + 'you\'re seeing this, you\'re calling `stopPropagation` on a ' +
98 + 'released/nullified synthetic event. This is a no-op. See ' +
99 + 'https://fb.me/react-event-pooling for more information.'
100 );
101 });
102 });