| 7 | */ |
| 8 | |
| 9 | export class MockEvent implements Event { |
| 10 | readonly AT_TARGET = 2; |
| 11 | readonly BUBBLING_PHASE = 3; |
| 12 | readonly CAPTURING_PHASE = 1; |
| 13 | readonly NONE = 0; |
| 14 | |
| 15 | readonly bubbles = false; |
| 16 | cancelBubble = false; |
| 17 | readonly cancelable = false; |
| 18 | readonly composed = false; |
| 19 | readonly currentTarget = null; |
| 20 | readonly defaultPrevented = false; |
| 21 | readonly eventPhase = -1; |
| 22 | readonly isTrusted = false; |
| 23 | returnValue = false; |
| 24 | readonly srcElement = null; |
| 25 | readonly target = null; |
| 26 | readonly timeStamp = Date.now(); |
| 27 | |
| 28 | constructor(readonly type: string) {} |
| 29 | |
| 30 | composedPath(): EventTarget[] { |
| 31 | this.notImplemented(); |
| 32 | } |
| 33 | initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void { |
| 34 | this.notImplemented(); |
| 35 | } |
| 36 | preventDefault(): void { |
| 37 | this.notImplemented(); |
| 38 | } |
| 39 | stopImmediatePropagation(): void { |
| 40 | this.notImplemented(); |
| 41 | } |
| 42 | stopPropagation(): void { |
| 43 | this.notImplemented(); |
| 44 | } |
| 45 | |
| 46 | private notImplemented(): never { |
| 47 | throw new Error('Method not implemented in `MockEvent`.'); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | export class MockExtendableEvent extends MockEvent implements ExtendableEvent { |
| 52 | private queue: Promise<unknown>[] = []; |