forked from denoland/deno
-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom_event_test.ts
27 lines (24 loc) · 864 Bytes
/
custom_event_test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import { test, assertEquals } from "./test_util.ts";
test(function customEventInitializedWithDetail() {
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() {
const type = "touchstart";
const event = new CustomEvent(type, {});
assertEquals(event.toString(), "[object CustomEvent]");
});