3 <script src=
"../../../resources/testharness.js"></script>
4 <script src=
"../../../resources/testharnessreport.js"></script>
9 var p
= new Promise(function(resolve
, reject
) {});
11 // No initializer is passed.
12 assert_equals(new PromiseRejectionEvent('eventType').bubbles
, false);
13 assert_equals(new PromiseRejectionEvent('eventType').cancelable
, false);
14 assert_equals(new PromiseRejectionEvent('eventType').promise
, null);
15 assert_equals(new PromiseRejectionEvent('eventType').reason
, null);
17 // No promise is passed.
18 assert_throws(new TypeError(),
20 new PromiseRejectionEvent('eventType', { bubbles
: false });
22 'Cannot construct PromiseRejectionEventInit without promise');
25 assert_equals(new PromiseRejectionEvent('eventType', { bubbles
: false, promise
: p
}).bubbles
, false);
26 assert_equals(new PromiseRejectionEvent('eventType', { bubbles
: true, promise
: p
}).bubbles
, true);
28 // cancelable is passed.
29 assert_equals(new PromiseRejectionEvent('eventType', { cancelable
: false, promise
: p
}).cancelable
, false);
30 assert_equals(new PromiseRejectionEvent('eventType', { cancelable
: true, promise
: p
}).cancelable
, true);
33 assert_equals(new PromiseRejectionEvent('eventType', { promise
: p
}).promise
, p
);
37 assert_equals(new PromiseRejectionEvent('eventType', { promise
: p
, reason
: r
}).reason
, r
);
40 // All initializers are passed.
41 assert_equals(new PromiseRejectionEvent('eventType', { bubbles
: true, cancelable
: true, promise
: p
, reason
: r
}).bubbles
, true);
42 assert_equals(new PromiseRejectionEvent('eventType', { bubbles
: true, cancelable
: true, promise
: p
, reason
: r
}).cancelable
, true);
43 assert_equals(new PromiseRejectionEvent('eventType', { bubbles
: true, cancelable
: true, promise
: p
, reason
: r
}).promise
, p
);
44 assert_equals(new PromiseRejectionEvent('eventType', { bubbles
: true, cancelable
: true, promise
: p
, reason
: r
}).reason
, r
);
45 }, "This tests the constructor for the PromiseRejectionEvent DOM class.");