mirror of
https://github.com/denoland/deno.git
synced 2024-12-27 17:49:08 -05:00
9dfebbc949
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: LE GOFF Vincent <g_n_s@hotmail.fr>
27 lines
876 B
TypeScript
27 lines
876 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 customEventDict = new CustomEventInit({
|
|
bubbles: true,
|
|
cancelable: true,
|
|
detail
|
|
});
|
|
const event = new CustomEvent(type, customEventDict);
|
|
|
|
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]");
|
|
});
|