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

Unified Diff: LayoutTests/fast/dom/global-event-handlers.html

Issue 26467002: Add LayoutTest for GlobalEventHandlers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: re-indent Created 7 years, 2 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
« no previous file with comments | « no previous file | LayoutTests/fast/dom/global-event-handlers-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/global-event-handlers.html
diff --git a/LayoutTests/fast/dom/global-event-handlers.html b/LayoutTests/fast/dom/global-event-handlers.html
new file mode 100644
index 0000000000000000000000000000000000000000..9432fad8ebc0538c54dbfe6e23c90cc0fc222756
--- /dev/null
+++ b/LayoutTests/fast/dom/global-event-handlers.html
@@ -0,0 +1,110 @@
+<!DOCTYPE html>
+<title>GlobalEventHandlers test</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+// attribute list from WHATWG HTML Living Standard r8212
+var attributes = [
+ "onabort",
+ "onblur",
+ "onerror",
+ "onfocus",
+ "oncancel",
+ "oncanplay",
+ "oncanplaythrough",
+ "onchange",
+ "onclick",
+ "onclose",
+ "oncontextmenu",
+ "oncuechange",
+ "ondblclick",
+ "ondrag",
+ "ondragend",
+ "ondragenter",
+ "ondragexit",
+ "ondragleave",
+ "ondragover",
+ "ondragstart",
+ "ondrop",
+ "ondurationchange",
+ "onemptied",
+ "onended",
+ "oninput",
+ "oninvalid",
+ "onkeydown",
+ "onkeypress",
+ "onkeyup",
+ "onload",
+ "onloadeddata",
+ "onloadedmetadata",
+ "onloadstart",
+ "onmousedown",
+ "onmouseenter",
+ "onmouseleave",
+ "onmousemove",
+ "onmouseout",
+ "onmouseover",
+ "onmouseup",
+ "onmousewheel",
+ "onpause",
+ "onplay",
+ "onplaying",
+ "onprogress",
+ "onratechange",
+ "onreset",
+ "onscroll",
+ "onseeked",
+ "onseeking",
+ "onselect",
+ "onshow",
+ "onsort",
+ "onstalled",
+ "onsubmit",
+ "onsuspend",
+ "ontimeupdate",
+ "onvolumechange",
+ "onwaiting"
+];
+function testSet(object, attribute, name) {
+ function nop() {}
+ test(function() {
+ assert_equals(object[attribute], null, "Initially null");
+ object[attribute] = nop;
+ assert_equals(object[attribute], nop, "Return same function");
+ document[attribute] = "";
+ assert_equals(document[attribute], null, "Return null after setting string");
+ }, "Set " + name + "." + attribute);
+}
+function testEnumerate(object, name) {
+ // Object.propertyIsEnumerable cannot be used because it doesn't
+ // work with properties inherited through the prototype chain.
+ test(function() {
+ var seen = {};
+ attributes.forEach(function(attribute) {
+ seen[attribute] = false;
+ });
+ for (var attribute in object) {
+ seen[attribute] = true;
+ }
+ attributes.forEach(function(attribute) {
+ assert_true(seen[attribute], "Found " + attribute);
+ });
+ }, "Enumerate " + name + ".on*");
+}
+attributes.forEach(function(attribute) {
+ testSet(document.createElement('div'), attribute, "element");
+ test(function() {
+ var element = document.createElement('div');
+ assert_equals(element.getAttribute(attribute), null, "Initially null");
+ element.setAttribute(attribute, "return");
+ assert_equals(element.getAttribute(attribute), "return", "Return same string");
+ assert_equals(typeof element[attribute], "function", "Convert to function");
+ }, "Reflect element." + attribute);
+ testSet(document, attribute, "document");
+ testSet(window, attribute, "window");
+});
+testEnumerate(document.createElement('div'), "element");
+testEnumerate(document, "document");
+testEnumerate(window, "window");
+</script>
+<div id="log"></div>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/global-event-handlers-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698