xref: /third_party/node/test/parallel/test-whatwg-events-event-constructors.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_cirequire('../common');
41cb0ef41Sopenharmony_ciconst { test, assert_equals, assert_array_equals } =
51cb0ef41Sopenharmony_ci  require('../common/wpt').harness;
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci// Source: https://github.com/web-platform-tests/wpt/blob/6cef1d2087d6a07d7cc6cee8cf207eec92e27c5f/dom/events/Event-constructors.any.js#L91-L112
81cb0ef41Sopenharmony_citest(function() {
91cb0ef41Sopenharmony_ci  const called = [];
101cb0ef41Sopenharmony_ci  const ev = new Event('Xx', {
111cb0ef41Sopenharmony_ci    get cancelable() {
121cb0ef41Sopenharmony_ci      called.push('cancelable');
131cb0ef41Sopenharmony_ci      return false;
141cb0ef41Sopenharmony_ci    },
151cb0ef41Sopenharmony_ci    get bubbles() {
161cb0ef41Sopenharmony_ci      called.push('bubbles');
171cb0ef41Sopenharmony_ci      return true;
181cb0ef41Sopenharmony_ci    },
191cb0ef41Sopenharmony_ci    get sweet() {
201cb0ef41Sopenharmony_ci      called.push('sweet');
211cb0ef41Sopenharmony_ci      return 'x';
221cb0ef41Sopenharmony_ci    },
231cb0ef41Sopenharmony_ci  });
241cb0ef41Sopenharmony_ci  assert_array_equals(called, ['bubbles', 'cancelable']);
251cb0ef41Sopenharmony_ci  assert_equals(ev.type, 'Xx');
261cb0ef41Sopenharmony_ci  assert_equals(ev.bubbles, true);
271cb0ef41Sopenharmony_ci  assert_equals(ev.cancelable, false);
281cb0ef41Sopenharmony_ci  assert_equals(ev.sweet, undefined);
291cb0ef41Sopenharmony_ci});
30

Indexes created Thu Nov 07 10:32:03 CST 2024