OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset="utf-8"> |
| 3 <script src="../../../resources/testharness.js"></script> |
| 4 <script src="../../../resources/testharnessreport.js"></script> |
| 5 <script> |
| 6 'use strict'; |
| 7 |
| 8 test(function() { |
| 9 // No initializer is passed. |
| 10 assert_equals(new PromiseRejectionEvent('eventType').bubbles, false); |
| 11 assert_equals(new PromiseRejectionEvent('eventType').cancelable, false); |
| 12 assert_equals(new PromiseRejectionEvent('eventType').promise, undefined); |
| 13 assert_equals(new PromiseRejectionEvent('eventType').reason, undefined); |
| 14 |
| 15 // bubbles is passed. |
| 16 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: false }).bubbl
es, false); |
| 17 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true }).bubble
s, true); |
| 18 |
| 19 // cancelable is passed. |
| 20 assert_equals(new PromiseRejectionEvent('eventType', { cancelable: false }).ca
ncelable, false); |
| 21 assert_equals(new PromiseRejectionEvent('eventType', { cancelable: true }).can
celable, true); |
| 22 |
| 23 // promise is passed. |
| 24 var p = new Promise(function(resolve, reject) {}); |
| 25 assert_equals(new PromiseRejectionEvent('eventType', { promise: p }).promise,
p); |
| 26 |
| 27 // reason is passed. |
| 28 var r = new Error(); |
| 29 assert_equals(new PromiseRejectionEvent('eventType', { reason: r }).reason, r)
; |
| 30 |
| 31 |
| 32 // All initializers are passed. |
| 33 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, cancelab
le: true, promise: p, reason: r }).bubbles, true); |
| 34 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, cancelab
le: true, promise: p, reason: r }).cancelable, true); |
| 35 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, cancelab
le: true, promise: p, reason: r }).promise, p); |
| 36 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, cancelab
le: true, promise: p, reason: r }).reason, r); |
| 37 }, "This tests the constructor for the PromiseRejectionEvent DOM class."); |
| 38 </script> |
OLD | NEW |