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

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

Issue 37283002: Drop NotEnumerable for the on* event handler IDL attributes (again) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rm redundant test Created 7 years, 1 month 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>GlobalEventHandlers test</title> 2 <title>GlobalEventHandlers test</title>
3 <script src="../../resources/testharness.js"></script> 3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script> 4 <script src="../../resources/testharnessreport.js"></script>
5 <script src="script-tests/event-handlers.js"></script>
5 <script> 6 <script>
6 // attribute list from WHATWG HTML Living Standard r8212 7 // attribute list from WHATWG HTML Living Standard r8212
7 var attributes = [ 8 [
8 "onabort", 9 "onabort",
9 "onblur", 10 "onblur",
10 "onerror", 11 "onerror",
11 "onfocus", 12 "onfocus",
12 "oncancel", 13 "oncancel",
13 "oncanplay", 14 "oncanplay",
14 "oncanplaythrough", 15 "oncanplaythrough",
15 "onchange", 16 "onchange",
16 "onclick", 17 "onclick",
17 "onclose", 18 "onclose",
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 "onseeking", 58 "onseeking",
58 "onselect", 59 "onselect",
59 "onshow", 60 "onshow",
60 "onsort", 61 "onsort",
61 "onstalled", 62 "onstalled",
62 "onsubmit", 63 "onsubmit",
63 "onsuspend", 64 "onsuspend",
64 "ontimeupdate", 65 "ontimeupdate",
65 "onvolumechange", 66 "onvolumechange",
66 "onwaiting" 67 "onwaiting"
67 ]; 68 ].forEach(function(attribute) {
68 function getObject(interface) {
69 switch(interface) {
70 case "Element":
71 var e = document.createElementNS("http://example.com/", "example");
72 assert_true(e instanceof Element);
73 assert_false(e instanceof HTMLElement);
74 assert_false(e instanceof SVGElement);
75 return e;
76 case "HTMLElement":
77 var e = document.createElement("html");
78 assert_true(e instanceof HTMLElement);
79 return e;
80 case "SVGElement":
81 var e = document.createElementNS("http://www.w3.org/2000/svg", "rect ");
82 assert_true(e instanceof SVGElement);
83 return e;
84 case "Document":
85 assert_true(document instanceof Document);
86 return document;
87 case "Window":
88 assert_true(window instanceof Window);
89 return window;
90 }
91 assert_unreached();
92 }
93 function testSet(interface, attribute) {
94 test(function() {
95 var object = getObject(interface);
96 function nop() {}
97 assert_equals(object[attribute], null, "Initially null");
98 object[attribute] = nop;
99 assert_equals(object[attribute], nop, "Return same function");
100 document[attribute] = "";
101 assert_equals(document[attribute], null, "Return null after setting stri ng");
102 }, "Set " + interface + "." + attribute);
103 }
104 function testReflect(interface, attribute) {
105 test(function() {
106 var element = getObject(interface);
107 assert_equals(element.getAttribute(attribute), null, "Initially null");
108 element.setAttribute(attribute, "return");
109 assert_equals(element.getAttribute(attribute), "return", "Return same st ring");
110 assert_equals(typeof element[attribute], "function", "Convert to functio n");
111 }, "Reflect " + interface + "." + attribute);
112 }
113 // Object.propertyIsEnumerable cannot be used because it doesn't
114 // work with properties inherited through the prototype chain.
115 var enumerable = {
116 "Element": {},
117 "HTMLElement": {},
118 "SVGElement": {},
119 "Document": {},
120 "Window": {}
121 };
122 Object.keys(enumerable).forEach(function(interface) {
123 for (var attribute in getObject(interface)) {
124 enumerable[interface][attribute] = true;
125 }
126 });
127 function testEnumerate(interface, attribute) {
128 test(function() {
129 assert_true(enumerable[interface][attribute]);
130 }, "Enumerate " + interface + "." + attribute);
131 }
132 attributes.forEach(function(attribute) {
133 test(function() { 69 test(function() {
134 assert_false(attribute in getObject("Element")); 70 assert_false(attribute in getObject("Element"));
135 }, "No Element." + attribute); 71 }, "No Element." + attribute);
136 testSet("HTMLElement", attribute); 72 testSet("HTMLElement", attribute);
137 testEnumerate("HTMLElement", attribute); 73 testEnumerate("HTMLElement", attribute);
138 testReflect("HTMLElement", attribute); 74 testReflect("HTMLElement", attribute);
139 testSet("SVGElement", attribute); 75 testSet("SVGElement", attribute);
140 testEnumerate("SVGElement", attribute); 76 testEnumerate("SVGElement", attribute);
141 testReflect("SVGElement", attribute); 77 testReflect("SVGElement", attribute);
142 testSet("Document", attribute); 78 testSet("Document", attribute);
143 testEnumerate("Document", attribute); 79 testEnumerate("Document", attribute);
144 testSet("Window", attribute); 80 testSet("Window", attribute);
145 testEnumerate("Window", attribute); 81 testEnumerate("Window", attribute);
146 }); 82 });
147 </script> 83 </script>
148 <div id="log"></div> 84 <div id="log"></div>
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/body-frameset-event-handlers-expected.txt ('k') | LayoutTests/fast/dom/script-tests/event-handlers.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698