11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciconst { strictEqual, throws, equal } = require('assert'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci// Manually converted from https://github.com/web-platform-tests/wpt/blob/master/dom/events/CustomEvent.html 81cb0ef41Sopenharmony_ci// in order to define the `document` ourselves 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci{ 111cb0ef41Sopenharmony_ci const type = 'foo'; 121cb0ef41Sopenharmony_ci const target = new EventTarget(); 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ci target.addEventListener(type, common.mustCall((evt) => { 151cb0ef41Sopenharmony_ci strictEqual(evt.type, type); 161cb0ef41Sopenharmony_ci })); 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ci target.dispatchEvent(new Event(type)); 191cb0ef41Sopenharmony_ci} 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_ci{ 221cb0ef41Sopenharmony_ci throws(() => { 231cb0ef41Sopenharmony_ci new Event(); 241cb0ef41Sopenharmony_ci }, TypeError); 251cb0ef41Sopenharmony_ci} 261cb0ef41Sopenharmony_ci 271cb0ef41Sopenharmony_ci{ 281cb0ef41Sopenharmony_ci const event = new Event('foo'); 291cb0ef41Sopenharmony_ci equal(event.type, 'foo'); 301cb0ef41Sopenharmony_ci equal(event.bubbles, false); 311cb0ef41Sopenharmony_ci equal(event.cancelable, false); 321cb0ef41Sopenharmony_ci equal(event.detail, null); 331cb0ef41Sopenharmony_ci} 34