Fix code style/grammar on synthetic event warning

This commit is contained in:
Ben Alpert
2015-08-31 11:32:01 -07:00
parent 0ff65cc892
commit 42602a8922
2 changed files with 28 additions and 24 deletions
@@ -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();
@@ -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.'
);
});
});