Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/constructors/promise-rejection-event-constructor.html

Issue 1471283002: Update PromiseRejectionEvent IDL to match latest spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/events/PromiseRejectionEvent.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <meta charset="utf-8"> 2 <meta charset="utf-8">
3 <script src="../../../resources/testharness.js"></script> 3 <script src="../../../resources/testharness.js"></script>
4 <script src="../../../resources/testharnessreport.js"></script> 4 <script src="../../../resources/testharnessreport.js"></script>
5 <script> 5 <script>
6 'use strict'; 6 'use strict';
7 7
8 test(function() { 8 test(function() {
9 var p = new Promise(function(resolve, reject) {}); 9 var p = new Promise(function(resolve, reject) {});
10 10
11 // No initializer is passed. 11 // No custom options are passed (besides required promise).
12 assert_equals(new PromiseRejectionEvent('eventType').bubbles, false); 12 assert_equals(new PromiseRejectionEvent('eventType', { promise: p }).bubbles, false);
13 assert_equals(new PromiseRejectionEvent('eventType').cancelable, false); 13 assert_equals(new PromiseRejectionEvent('eventType', { promise: p }).cancelabl e, false);
14 assert_equals(new PromiseRejectionEvent('eventType').promise, null); 14 assert_equals(new PromiseRejectionEvent('eventType', { promise: p }).promise, p);
15 assert_equals(new PromiseRejectionEvent('eventType').reason, null); 15 assert_equals(new PromiseRejectionEvent('eventType', { promise: p }).reason, u ndefined);
16 16
17 // No promise is passed. 17 // No promise is passed.
18 assert_throws(new TypeError(), 18 assert_throws(new TypeError(),
19 function() { 19 function() {
20 new PromiseRejectionEvent('eventType', { bubbles: false }); 20 new PromiseRejectionEvent('eventType', { bubbles: false });
21 }, 21 },
22 'Cannot construct PromiseRejectionEventInit without promise'); 22 'Cannot construct PromiseRejectionEventInit without promise');
23 23
24 // bubbles is passed. 24 // bubbles is passed.
25 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: false, promise : p }).bubbles, false); 25 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: false, promise : p }).bubbles, false);
26 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, promise: p }).bubbles, true); 26 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, promise: p }).bubbles, true);
27 27
28 // cancelable is passed. 28 // cancelable is passed.
29 assert_equals(new PromiseRejectionEvent('eventType', { cancelable: false, prom ise: p }).cancelable, false); 29 assert_equals(new PromiseRejectionEvent('eventType', { cancelable: false, prom ise: p }).cancelable, false);
30 assert_equals(new PromiseRejectionEvent('eventType', { cancelable: true, promi se: p }).cancelable, true); 30 assert_equals(new PromiseRejectionEvent('eventType', { cancelable: true, promi se: p }).cancelable, true);
31 31
32 // promise is passed.
33 assert_equals(new PromiseRejectionEvent('eventType', { promise: p }).promise, p);
34
35 // reason is passed. 32 // reason is passed.
36 var r = new Error(); 33 var r = new Error();
37 assert_equals(new PromiseRejectionEvent('eventType', { promise: p, reason: r } ).reason, r); 34 assert_equals(new PromiseRejectionEvent('eventType', { promise: p, reason: r } ).reason, r);
38 35
39 36
40 // All initializers are passed. 37 // All initializers are passed.
41 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, cancelab le: true, promise: p, reason: r }).bubbles, true); 38 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, cancelab le: true, promise: p, reason: r }).bubbles, true);
42 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, cancelab le: true, promise: p, reason: r }).cancelable, true); 39 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, cancelab le: true, promise: p, reason: r }).cancelable, true);
43 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, cancelab le: true, promise: p, reason: r }).promise, p); 40 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, cancelab le: true, promise: p, reason: r }).promise, p);
44 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, cancelab le: true, promise: p, reason: r }).reason, r); 41 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, cancelab le: true, promise: p, reason: r }).reason, r);
45 }, "This tests the constructor for the PromiseRejectionEvent DOM class."); 42 }, "This tests the constructor for the PromiseRejectionEvent DOM class.");
46 </script> 43 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/events/PromiseRejectionEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698