mirror of
https://github.com/denoland/deno.git
synced 2024-10-30 09:08:00 -04:00
e55e4a2838
This removes the EventListener, EventInit and CustomEventInit constructors from the userland globals. The type exports stay. I removed the internal classes as well. EventListener's implementation seemed to be doing some bookkeeping on handled events but that's not being used anywhere so I assume it's old debug stuff. The other two are completely redundant.
27 lines
874 B
TypeScript
27 lines
874 B
TypeScript
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
|
|
import { test, assertEquals } from "./test_util.ts";
|
|
|
|
test(function customEventInitializedWithDetail(): void {
|
|
const type = "touchstart";
|
|
const detail = { message: "hello" };
|
|
const customEventInit = {
|
|
bubbles: true,
|
|
cancelable: true,
|
|
detail
|
|
} as CustomEventInit;
|
|
const event = new CustomEvent(type, customEventInit);
|
|
|
|
assertEquals(event.bubbles, true);
|
|
assertEquals(event.cancelable, true);
|
|
assertEquals(event.currentTarget, null);
|
|
assertEquals(event.detail, detail);
|
|
assertEquals(event.isTrusted, false);
|
|
assertEquals(event.target, null);
|
|
assertEquals(event.type, type);
|
|
});
|
|
|
|
test(function toStringShouldBeWebCompatibility(): void {
|
|
const type = "touchstart";
|
|
const event = new CustomEvent(type, {});
|
|
assertEquals(event.toString(), "[object CustomEvent]");
|
|
});
|