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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/events/constructors/promise-rejection-event-constructor.html
diff --git a/LayoutTests/fast/events/constructors/promise-rejection-event-constructor.html b/LayoutTests/fast/events/constructors/promise-rejection-event-constructor.html
new file mode 100644
index 0000000000000000000000000000000000000000..f19d751c5fbdbe1a785570c03435131c3d33e0c8
--- /dev/null
+++ b/LayoutTests/fast/events/constructors/promise-rejection-event-constructor.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script>
+'use strict';
+
+test(function() {
+ // No initializer is passed.
+ assert_equals(new PromiseRejectionEvent('eventType').bubbles, false);
+ assert_equals(new PromiseRejectionEvent('eventType').cancelable, false);
+ assert_equals(new PromiseRejectionEvent('eventType').promise, undefined);
+ assert_equals(new PromiseRejectionEvent('eventType').reason, undefined);
+
+ // bubbles is passed.
+ assert_equals(new PromiseRejectionEvent('eventType', { bubbles: false }).bubbles, false);
+ assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true }).bubbles, true);
+
+ // cancelable is passed.
+ assert_equals(new PromiseRejectionEvent('eventType', { cancelable: false }).cancelable, false);
+ assert_equals(new PromiseRejectionEvent('eventType', { cancelable: true }).cancelable, true);
+
+ // promise is passed.
+ var p = new Promise(function(resolve, reject) {});
+ assert_equals(new PromiseRejectionEvent('eventType', { promise: p }).promise, p);
+
+ // reason is passed.
+ var r = new Error();
+ assert_equals(new PromiseRejectionEvent('eventType', { reason: r }).reason, r);
+
+
+ // All initializers are passed.
+ assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, cancelable: true, promise: p, reason: r }).bubbles, true);
+ assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, cancelable: true, promise: p, reason: r }).cancelable, true);
+ assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, cancelable: true, promise: p, reason: r }).promise, p);
+ assert_equals(new PromiseRejectionEvent('eventType', { bubbles: true, cancelable: true, promise: p, reason: r }).reason, r);
+}, "This tests the constructor for the PromiseRejectionEvent DOM class.");
+</script>
« 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