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

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

Issue 2798273002: Remove now-redundant promise rejection event tests (Closed)
Patch Set: Created 3 years, 8 months 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
OLDNEW
(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 var p = new Promise(function(resolve, reject) {});
10
11 // No custom options are passed (besides required promise).
12 assert_equals(new PromiseRejectionEvent('eventType', { promise: p }).bubbles, false);
13 assert_equals(new PromiseRejectionEvent('eventType', { promise: p }).cancelabl e, false);
14 assert_equals(new PromiseRejectionEvent('eventType', { promise: p }).promise, p);
15 assert_equals(new PromiseRejectionEvent('eventType', { promise: p }).reason, u ndefined);
16
17 // No promise is passed.
18 assert_throws(new TypeError(),
19 function() {
20 new PromiseRejectionEvent('eventType', { bubbles: false });
21 },
22 'Cannot construct PromiseRejectionEventInit without promise');
23
24 // bubbles is passed.
25 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: false, promise : p }).bubbles, false);
26 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, promise: p }).bubbles, true);
27
28 // cancelable is passed.
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);
31
32 // reason is passed.
33 var r = new Error();
34 assert_equals(new PromiseRejectionEvent('eventType', { promise: p, reason: r } ).reason, r);
35
36
37 // All initializers are passed.
38 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, cancelab le: true, promise: p, reason: r }).bubbles, true);
39 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, cancelab le: true, promise: p, reason: r }).cancelable, true);
40 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, cancelab le: true, promise: p, reason: r }).promise, p);
41 assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, cancelab le: true, promise: p, reason: r }).reason, r);
42 }, "This tests the constructor for the PromiseRejectionEvent DOM class.");
43 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698