1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00
denoland-deno/cli/js/custom_event_test.ts
2020-01-02 18:41:59 -05:00

27 lines
879 B
TypeScript

// Copyright 2018-2020 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]");
});