• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3require('../common');
4const { test, assert_equals, assert_array_equals } =
5  require('../common/wpt').harness;
6
7// Source: https://github.com/web-platform-tests/wpt/blob/6cef1d2087d6a07d7cc6cee8cf207eec92e27c5f/dom/events/Event-constructors.any.js#L91-L112
8test(function() {
9  const called = [];
10  const ev = new Event('Xx', {
11    get cancelable() {
12      called.push('cancelable');
13      return false;
14    },
15    get bubbles() {
16      called.push('bubbles');
17      return true;
18    },
19    get sweet() {
20      called.push('sweet');
21      return 'x';
22    },
23  });
24  assert_array_equals(called, ['bubbles', 'cancelable']);
25  assert_equals(ev.type, 'Xx');
26  assert_equals(ev.bubbles, true);
27  assert_equals(ev.cancelable, false);
28  assert_equals(ev.sweet, undefined);
29});
30