|
@@ -86,11 +86,14 @@ describe('SyntheticEvent', function() { |
|
|
expect(syntheticEvent.type).toBe(null);
|
|
|
expect(syntheticEvent.nativeEvent).toBe(null);
|
|
|
expect(syntheticEvent.target).toBe(null);
|
|
|
- expect(console.error.calls.length).toBe(3); // once for each property accessed
|
|
|
- expect(console.error.argsForCall[0][0]).toBe( // assert the first warning for accessing `type`
|
|
|
- 'Warning: This synthetic event is reused for performance reasons. If you\'re seeing this, ' +
|
|
|
- 'you\'re accessing the property `type` on a released/nullified synthetic event. This is set to null. ' +
|
|
|
- 'If you must keep the original synthetic event around, use event.persist(). ' +
|
|
|
+ // once for each property accessed
|
|
|
+ expect(console.error.calls.length).toBe(3);
|
|
|
+ // assert the first warning for accessing `type`
|
|
|
+ expect(console.error.argsForCall[0][0]).toBe(
|
|
|
+ 'Warning: This synthetic event is reused for performance reasons. If ' +
|
|
|
+ 'you\'re seeing this, you\'re accessing the property `type` on a ' +
|
|
|
+ 'released/nullified synthetic event. This is set to null. If you must ' +
|
|
|
+ 'keep the original synthetic event around, use event.persist(). ' +
|
|
|
'See https://fb.me/react-event-pooling for more information.'
|
|
|
);
|
|
|
});
|
|
@@ -103,10 +106,11 @@ describe('SyntheticEvent', function() { |
|
|
expect(syntheticEvent.type = 'MouseEvent').toBe('MouseEvent');
|
|
|
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 setting the property `type` on a released/nullified synthetic event. This is ' +
|
|
|
- 'effectively a no-op. If you must keep the original synthetic event around, use ' +
|
|
|
- 'event.persist(). See https://fb.me/react-event-pooling for more information.'
|
|
|
+ 'Warning: This synthetic event is reused for performance reasons. If ' +
|
|
|
+ 'you\'re seeing this, you\'re setting the property `type` on a ' +
|
|
|
+ 'released/nullified synthetic event. This is effectively a no-op. If you must ' +
|
|
|
+ 'keep the original synthetic event around, use event.persist(). ' +
|
|
|
+ 'See https://fb.me/react-event-pooling for more information.'
|
|
|
);
|
|
|
});
|
|
|
|
|
@@ -117,10 +121,11 @@ describe('SyntheticEvent', function() { |
|
|
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 accessing the method `preventDefault` on a released/nullified synthetic event. ' +
|
|
|
- 'This is a no-op function. If you must keep the original synthetic event around, ' +
|
|
|
- 'use event.persist(). See https://fb.me/react-event-pooling for more information.'
|
|
|
+ 'Warning: This synthetic event is reused for performance reasons. If ' +
|
|
|
+ 'you\'re seeing this, you\'re accessing the method `preventDefault` on a ' +
|
|
|
+ 'released/nullified synthetic event. This is a no-op function. If you must ' +
|
|
|
+ 'keep the original synthetic event around, use event.persist(). ' +
|
|
|
+ 'See https://fb.me/react-event-pooling for more information.'
|
|
|
);
|
|
|
});
|
|
|
|
|
@@ -131,10 +136,11 @@ describe('SyntheticEvent', function() { |
|
|
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 accessing the method `stopPropagation` on a released/nullified synthetic event. ' +
|
|
|
- 'This is a no-op function. If you must keep the original synthetic event around, ' +
|
|
|
- 'use event.persist(). See https://fb.me/react-event-pooling for more information.'
|
|
|
+ 'Warning: This synthetic event is reused for performance reasons. If ' +
|
|
|
+ 'you\'re seeing this, you\'re accessing the method `stopPropagation` on a ' +
|
|
|
+ 'released/nullified synthetic event. This is a no-op function. If you must ' +
|
|
|
+ 'keep the original synthetic event around, use event.persist(). ' +
|
|
|
+ 'See https://fb.me/react-event-pooling for more information.'
|
|
|
);
|
|
|
});
|
|
|
|
|
@@ -154,9 +160,10 @@ describe('SyntheticEvent', function() { |
|
|
|
|
|
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 accessing the property `nativeEvent` on a released/nullified synthetic event. ' +
|
|
|
- 'This is set to null. If you must keep the original synthetic event around, use event.persist(). ' +
|
|
|
+ 'Warning: This synthetic event is reused for performance reasons. If ' +
|
|
|
+ 'you\'re seeing this, you\'re accessing the property `nativeEvent` on a ' +
|
|
|
+ 'released/nullified synthetic event. This is set to null. If you must ' +
|
|
|
+ 'keep the original synthetic event around, use event.persist(). ' +
|
|
|
'See https://fb.me/react-event-pooling for more information.'
|
|
|
);
|
|
|
});
|
|
@@ -170,9 +177,10 @@ describe('SyntheticEvent', function() { |
|
|
if (typeof Proxy === 'function') {
|
|
|
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 adding a new property in the synthetic event object. ' +
|
|
|
- 'The property is never released. See https://fb.me/react-event-pooling for more information.'
|
|
|
+ 'Warning: This synthetic event is reused for performance reasons. If ' +
|
|
|
+ 'you\'re seeing this, you\'re adding a new property in the synthetic ' +
|
|
|
+ 'event object. The property is never released. ' +
|
|
|
+ 'See https://fb.me/react-event-pooling for more information.'
|
|
|
);
|
|
|
} else {
|
|
|
expect(console.error.calls.length).toBe(0);
|
|
|
0 comments on commit
093bb22