mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 19:08:15 +00:00
move js unit tests to cli/tests (#5678)
This commit is contained in:
parent
49dda23f6b
commit
30702e2678
71 changed files with 14 additions and 14 deletions
27
cli/tests/unit/custom_event_test.ts
Normal file
27
cli/tests/unit/custom_event_test.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
||||
import { unitTest, assertEquals } from "./test_util.ts";
|
||||
|
||||
unitTest(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);
|
||||
});
|
||||
|
||||
unitTest(function toStringShouldBeWebCompatibility(): void {
|
||||
const type = "touchstart";
|
||||
const event = new CustomEvent(type, {});
|
||||
assertEquals(event.toString(), "[object CustomEvent]");
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue