diff options
Diffstat (limited to 'cli/tests/unit/event_test.ts')
-rw-r--r-- | cli/tests/unit/event_test.ts | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/cli/tests/unit/event_test.ts b/cli/tests/unit/event_test.ts index 9eb90fa36..9e5155964 100644 --- a/cli/tests/unit/event_test.ts +++ b/cli/tests/unit/event_test.ts @@ -1,5 +1,10 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -import { assert, assertEquals, unitTest } from "./test_util.ts"; +import { + assert, + assertEquals, + assertStringIncludes, + unitTest, +} from "./test_util.ts"; unitTest(function eventInitializedWithType(): void { const type = "click"; @@ -127,3 +132,30 @@ unitTest(function eventInspectOutput(): void { assertEquals(Deno.inspect(event), outputProvider(event)); } }); + +unitTest(function inspectEvent(): void { + // has a customInspect implementation that previously would throw on a getter + assertEquals( + Deno.inspect(Event.prototype), + `Event { + bubbles: [Getter/Setter], + cancelable: [Getter/Setter], + composed: [Getter/Setter], + currentTarget: [Getter/Setter], + defaultPrevented: [Getter/Setter], + eventPhase: [Getter/Setter], + srcElement: [Getter/Setter], + target: [Getter/Setter], + returnValue: [Getter/Setter], + timeStamp: [Getter/Setter], + type: [Getter/Setter] +}`, + ); + + // ensure this still works + assertStringIncludes( + Deno.inspect(new Event("test")), + // check a substring because one property is a timestamp + `Event {\n bubbles: false,\n cancelable: false,`, + ); +}); |