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

Unified Diff: LayoutTests/fast/events/event-listener-arguments.html

Issue 201603002: Simplify EventTarget bindings generation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Much more extensive Created 6 years, 9 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/event-listener-arguments.html
diff --git a/LayoutTests/fast/events/event-listener-arguments.html b/LayoutTests/fast/events/event-listener-arguments.html
new file mode 100644
index 0000000000000000000000000000000000000000..96107f853dc4cfe197065fdcaf22cd1dffdeca97
--- /dev/null
+++ b/LayoutTests/fast/events/event-listener-arguments.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<script src="../../resources/js-test.js"></script>
+<body>
+<script>
+description('EventTarget.addEventListener and EventTarget.removeEventLister should throw on invalid arguments.');
+
+function listener(event)
+{
+}
+
+debug('Signature:')
+debug('void addEventListener(DOMString type, EventListener listener, optional boolean useCapture)');
+shouldThrow('document.addEventListener()');
+shouldThrow('document.addEventListener("foo")');
+shouldNotThrow('document.addEventListener("foo", listener)');
+shouldNotThrow('document.addEventListener("", listener)');
+shouldNotThrow('document.addEventListener("", function(){})');
+shouldNotThrow('document.addEventListener("bar", listener, false)');
+shouldNotThrow('document.addEventListener("bar", listener, true)');
+// null
+shouldNotThrow('document.addEventListener(null, listener)'); // converted to "null"
+// FIXME: throw on |null|: http://crbug.com/249598
+// shouldThrow('document.addEventListener("foo", null)');
+shouldNotThrow('document.addEventListener("zork", listener, null)');
+// undefined
+// FIXME: behavior of undefined here is unclear, but probably should throw
+// https://www.w3.org/Bugs/Public/show_bug.cgi?id=23532
+// shouldThrow('document.addEventListener(undefined, listener)');
+// shouldThrow('document.addEventListener("foo", undefined)');
+shouldNotThrow('document.addEventListener("zork", listener, undefined)');
+
+debug('');
+debug('Signature:');
+debug('void removeEventListener(DOMString type, EventListener listener, optional boolean useCapture)');
+shouldThrow('document.removeEventListener()');
+shouldThrow('document.removeEventListener("foo")');
+shouldNotThrow('document.removeEventListener("foo", listener)');
+shouldNotThrow('document.removeEventListener("foo", listener, true)');
+shouldNotThrow('document.removeEventListener("bar", listener, false)');
+shouldNotThrow('document.removeEventListener("bar", listener, false)');
+shouldNotThrow('document.addEventListener("bar", listener, true)');
+// null
+shouldNotThrow('document.removeEventListener(null, listener)'); // converted to "null"
+// FIXME: throw on |null|: http://crbug.com/249598
+// shouldThrow('document.removeEventListener("foo", null)');
+shouldNotThrow('document.removeEventListener("zork", listener, null)');
+// undefined
+// FIXME: behavior of undefined here is unclear, but probably should throw
+// https://www.w3.org/Bugs/Public/show_bug.cgi?id=23532
+// shouldThrow('document.removeEventListener("foo", undefined)');
+// shouldThrow('document.removeEventListener(undefined, listener)');
+shouldNotThrow('document.removeEventListener("zork", listener, undefined)');
+</script>
« no previous file with comments | « no previous file | LayoutTests/fast/events/event-listener-arguments-expected.txt » ('j') | Source/bindings/templates/methods.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698