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

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

Issue 1179113007: Implement onunhandledrejection / onrejectionhandled events (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: updates Created 5 years, 6 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 | Annotate | Revision Log
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 // 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>
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/promise-rejection-events-onerror.html ('k') | LayoutTests/http/tests/dom/promise-rejection-events.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698