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

Side by Side Diff: LayoutTests/fast/dom/script-tests/event-handlers.js

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, 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 unified diff | Download patch
OLDNEW
(Empty)
1 function getObject(interface) {
2 switch(interface) {
3 case "Element":
4 var e = document.createElementNS("http://example.com/", "example");
5 assert_true(e instanceof Element);
6 assert_false(e instanceof HTMLElement);
7 assert_false(e instanceof SVGElement);
8 return e;
9 case "HTMLElement":
10 var e = document.createElement("html");
11 assert_true(e instanceof HTMLElement);
12 return e;
13 case "HTMLBodyElement":
14 var e = document.createElement("body");
15 assert_true(e instanceof HTMLBodyElement);
16 return e;
17 case "HTMLFormElement":
18 var e = document.createElement("form");
19 assert_true(e instanceof HTMLFormElement);
20 return e;
21 case "HTMLFrameSetElement":
22 var e = document.createElement("frameset");
23 assert_true(e instanceof HTMLFrameSetElement);
24 return e;
25 case "SVGElement":
26 var e = document.createElementNS("http://www.w3.org/2000/svg", "rect ");
27 assert_true(e instanceof SVGElement);
28 return e;
29 case "Document":
30 assert_true(document instanceof Document);
31 return document;
32 case "Window":
33 assert_true(window instanceof Window);
34 return window;
35 }
36 assert_unreached();
37 }
38 function testSet(interface, attribute) {
39 test(function() {
40 var object = getObject(interface);
41 function nop() {}
42 assert_equals(object[attribute], null, "Initially null");
43 object[attribute] = nop;
44 assert_equals(object[attribute], nop, "Return same function");
45 object[attribute] = "";
46 assert_equals(object[attribute], null, "Return null after setting string ");
47 object[attribute] = null;
48 assert_equals(object[attribute], null, "Finally null");
49 }, "Set " + interface + "." + attribute);
50 }
51 function testReflect(interface, attribute) {
52 test(function() {
53 var element = getObject(interface);
54 assert_false(element.hasAttribute(attribute), "Initially missing");
55 element.setAttribute(attribute, "return");
56 assert_equals(element.getAttribute(attribute), "return", "Return same st ring");
57 assert_equals(typeof element[attribute], "function", "Convert to functio n");
58 element.removeAttribute(attribute);
59 }, "Reflect " + interface + "." + attribute);
60 }
61 // Object.propertyIsEnumerable cannot be used because it doesn't
62 // work with properties inherited through the prototype chain.
63 function getEnumerable(interface) {
64 var enumerable = {};
65 for (var attribute in getObject(interface)) {
66 enumerable[attribute] = true;
67 }
68 return enumerable;
69 }
70 var enumerableCache = {};
71 function testEnumerate(interface, attribute) {
72 if (!(interface in enumerableCache)) {
73 enumerableCache[interface] = getEnumerable(interface);
74 }
75 test(function() {
76 assert_true(enumerableCache[interface][attribute]);
77 }, "Enumerate " + interface + "." + attribute);
78 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/global-event-handlers.html ('k') | LayoutTests/fast/dom/window-event-handlers.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698