mirror of
https://github.com/denoland/deno.git
synced 2024-11-15 16:43:44 -05:00
27 lines
880 B
TypeScript
27 lines
880 B
TypeScript
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
|
import { assertEquals, unitTest } from "./test_util.ts";
|
|
|
|
unitTest(function customEventInitializedWithDetail() {
|
|
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);
|
|
});
|
|
|
|
unitTest(function toStringShouldBeWebCompatibility() {
|
|
const type = "touchstart";
|
|
const event = new CustomEvent(type, {});
|
|
assertEquals(event.toString(), "[object CustomEvent]");
|
|
});
|