Skip to content

Commit

Permalink
Remove unused helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
devversion committed Feb 21, 2017
1 parent 53769ba commit a0128f4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
8 changes: 1 addition & 7 deletions src/lib/core/testing/dispatch-events.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import {
createFakeEvent,
createKeyboardEvent,
createMouseEvent,
createTransitionEndEvent
createMouseEvent
} from './event-objects';

/** Shorthand to dispatch a fake event on a specified node. */
Expand All @@ -19,8 +18,3 @@ export function dispatchKeyboardEvent(node: Node, type: string, keyCode: number)
export function dispatchMouseEvent(node: Node, type: string, x = 0, y = 0) {
node.dispatchEvent(createMouseEvent(type, x, y));
}

/** Shorthand to dispatch a transition event with a specified property. */
export function dispatchTransitionEndEvent(node: Node, propertyName: string, elapsedTime = 0) {
node.dispatchEvent(createTransitionEndEvent(propertyName, elapsedTime));
}
16 changes: 0 additions & 16 deletions src/lib/core/testing/event-objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,6 @@ export function createKeyboardEvent(type: string, keyCode: number) {
return event;
}

/** Creates a transition event with the specified property name. */
export function createTransitionEndEvent(propertyName: string, elapsedTime = 0) {
// Some browsers have the TransitionEvent class, but once the class is being instantiated
// the browser will throw an exception. Those browsers don't support the constructor yet.
// To ensure that those browsers also work, the TransitionEvent is created by using the
// deprecated `initTransitionEvent` function.
try {
// TypeScript does not have valid types for the TransitionEvent class, so use `any`.
return new (TransitionEvent as any)('transitionend', {propertyName, elapsedTime});
} catch (e) {
let event = document.createEvent('TransitionEvent');
event.initTransitionEvent('transitionend', false, false, propertyName, elapsedTime);
return event;
}
}

/** Creates a fake event object with any desired event type. */
export function createFakeEvent(type: string) {
let event = document.createEvent('Event');
Expand Down

0 comments on commit a0128f4

Please sign in to comment.