Touch properties should be on the prototype
[WebKit-https.git] / LayoutTests / platform / ios-simulator / ios / touch / Touch-attributes-prototype.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../../../../resources/js-test-pre.js"></script>
5 <script>
6 description("Checks that Touch attributes are on the prototype.");
7
8 var touch = new Touch({ identifier: 1, target: document.body });
9 shouldBe("touch.__proto__", "Touch.prototype");
10 shouldBe("Object.getOwnPropertyNames(touch).length", "0");
11
12 function checkAttributeGetter(prototype, propertyName)
13 {
14     descriptor = Object.getOwnPropertyDescriptor(prototype, propertyName);
15     shouldBeType("descriptor.get", "Function");
16     shouldBeTrue("descriptor.enumerable");
17     shouldBeTrue("descriptor.configurable");
18 }
19
20 for (var propertyName of ["identifier", "target", "screenX", "screenY", "clientX", "clientY", "pageX", "pageY", "force"]) {
21     debug("");
22     debug("* touch.__proto__." + propertyName);
23     checkAttributeGetter(touch.__proto__, propertyName);
24
25     debug("");
26     debug("* Touch.prototype." + propertyName);
27     checkAttributeGetter(Touch.prototype, propertyName);
28 }
29 </script>
30 <script src="../../../../resources/js-test-post.js"></script>
31 </body>
32 </html>