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

Unified Diff: third_party/WebKit/LayoutTests/fast/events/event-target-add-remove-listeners.html

Issue 2598353002: The second argument of add/removeEventListener should be an object, null, or undefined
Patch Set: Fix tests Created 3 years, 11 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: third_party/WebKit/LayoutTests/fast/events/event-target-add-remove-listeners.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/event-target-add-remove-listeners.html b/third_party/WebKit/LayoutTests/fast/events/event-target-add-remove-listeners.html
new file mode 100644
index 0000000000000000000000000000000000000000..34a958d5886bf9c4363adb8b17fb52d60ac34725
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/event-target-add-remove-listeners.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+
+test(function() {
+ assert_throws(new TypeError(), function() {
+ document.addEventListener('click', false);
+ });
+ assert_throws(new TypeError(), function() {
+ document.addEventListener('click', 'foo');
+ });
+ assert_throws(new TypeError(), function() {
+ document.addEventListener('click', 3.14);
+ });
+}, 'Throw a TypeError when the second argument of addEventListener is other than an object, null, or undefined');
+
+test(function() {
+ assert_throws(new TypeError(), function() {
+ document.removeEventListener('click', false);
+ });
+ assert_throws(new TypeError(), function() {
+ document.removeEventListener('click', 'foo');
+ });
+ assert_throws(new TypeError(), function() {
+ document.removeEventListener('click', 3.14);
+ });
+}, 'Throw a TypeError when the second argument of removeEventListener is other than an object, null, or undefined');
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698