mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
fix(op_crates/web): Expose event properties in console output (#8103)
Fixes #8073
This commit is contained in:
parent
b03f4a4a1c
commit
9fb4931a95
3 changed files with 104 additions and 5 deletions
|
@ -92,3 +92,41 @@ unitTest(function eventIsTrusted(): void {
|
|||
|
||||
assertEquals(desc1!.get, desc2!.get);
|
||||
});
|
||||
|
||||
unitTest(function eventInspectOutput(): void {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const cases: Array<[any, (event: any) => string]> = [
|
||||
[
|
||||
new Event("test"),
|
||||
(event: Event) =>
|
||||
`Event {\n bubbles: false,\n cancelable: false,\n composed: false,\n currentTarget: null,\n defaultPrevented: false,\n eventPhase: 0,\n target: null,\n timeStamp: ${event.timeStamp},\n type: "test"\n}`,
|
||||
],
|
||||
[
|
||||
new ErrorEvent("error"),
|
||||
(event: Event) =>
|
||||
`ErrorEvent {\n bubbles: false,\n cancelable: false,\n composed: false,\n currentTarget: null,\n defaultPrevented: false,\n eventPhase: 0,\n target: null,\n timeStamp: ${event.timeStamp},\n type: "error",\n message: "",\n filename: "",\n lineno: 0,\n colno: 0,\n error: null\n}`,
|
||||
],
|
||||
[
|
||||
new CloseEvent("close"),
|
||||
(event: Event) =>
|
||||
`CloseEvent {\n bubbles: false,\n cancelable: false,\n composed: false,\n currentTarget: null,\n defaultPrevented: false,\n eventPhase: 0,\n target: null,\n timeStamp: ${event.timeStamp},\n type: "close",\n wasClean: false,\n code: 0,\n reason: ""\n}`,
|
||||
],
|
||||
[
|
||||
new CustomEvent("custom"),
|
||||
(event: Event) =>
|
||||
`CustomEvent {\n bubbles: false,\n cancelable: false,\n composed: false,\n currentTarget: null,\n defaultPrevented: false,\n eventPhase: 0,\n target: null,\n timeStamp: ${event.timeStamp},\n type: "custom",\n detail: undefined\n}`,
|
||||
],
|
||||
[
|
||||
new ProgressEvent("progress"),
|
||||
(event: Event) =>
|
||||
`ProgressEvent {\n bubbles: false,\n cancelable: false,\n composed: false,\n currentTarget: null,\n defaultPrevented: false,\n eventPhase: 0,\n target: null,\n timeStamp: ${event.timeStamp},\n type: "progress",\n lengthComputable: false,\n loaded: 0,\n total: 0\n}`,
|
||||
],
|
||||
];
|
||||
|
||||
for (const [event, outputProvider] of cases) {
|
||||
assertEquals(
|
||||
event[Symbol.for("Deno.customInspect")](),
|
||||
outputProvider(event),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue