Skip to content

Commit

Permalink
warn(SyntheticEvent): Update tests to check for throwing when accessi…
Browse files Browse the repository at this point in the history
…ng properties on a destructored syntheticEvent
  • Loading branch information
Kent C. Dodds committed Jan 29, 2016
1 parent 9c3f595 commit cc49323
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ describe('SyntheticEvent', function() {
expect(syntheticEvent.isPersistent()).toBe(true);
});

it('should be nullified if the synthetic event has called destructor', function() {
it('should throw an error when trying to access properties if the synthetic event has called destructor', function() {
var target = document.createElement('div');
var syntheticEvent = createEvent({srcElement: target});
syntheticEvent.destructor();
expect(syntheticEvent.type).toBe(null);
expect(syntheticEvent.nativeEvent).toBe(null);
expect(syntheticEvent.target).toBe(null);
expect(() => syntheticEvent.type).toThrow();
expect(() => syntheticEvent.nativeEvent).toThrow();
expect(() => syntheticEvent.target).toThrow();
});

it('should warn if the synthetic event has been released when calling `preventDefault`', function() {
Expand Down

0 comments on commit cc49323

Please sign in to comment.