1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/base/test/test_constructor.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,61 @@ 1.4 +<!-- 1.5 + Any copyright is dedicated to the Public Domain. 1.6 + http://creativecommons.org/publicdomain/zero/1.0/ 1.7 +--> 1.8 +<!DOCTYPE html> 1.9 +<html> 1.10 +<head> 1.11 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.13 +</head> 1.14 +<body> 1.15 +<script type="application/javascript"> 1.16 +function testConstructor(name) 1.17 +{ 1.18 + window[name]; // resolve not through assignment 1.19 + window[name] = 17; 1.20 + 1.21 + var desc = Object.getOwnPropertyDescriptor(window, name); 1.22 + ok(typeof desc === "object" && desc !== null, name + ": property must exist"); 1.23 + 1.24 + is(desc.value, 17, name + ": overwrite didn't work correctly"); 1.25 + is(desc.enumerable, false, 1.26 + name + ": initial descriptor was non-enumerable, and [[Put]] changes " + 1.27 + "the property value but not its enumerability"); 1.28 + is(desc.configurable, true, 1.29 + name + ": initial descriptor was configurable, and [[Put]] changes the " + 1.30 + "property value but not its configurability"); 1.31 + is(desc.writable, true, 1.32 + name + ": initial descriptor was writable, and [[Put]] changes the " + 1.33 + "property value but not its writability"); 1.34 +} 1.35 + 1.36 +var ctors = 1.37 + [ 1.38 + "HTMLElement", 1.39 + "HTMLDivElement", 1.40 + "HTMLSpanElement", 1.41 + "HTMLParagraphElement", 1.42 + "HTMLOptionElement", 1.43 + "HTMLHtmlElement", 1.44 + "Element", 1.45 + "Node", 1.46 + "Document", 1.47 + "Image", 1.48 + "Audio", 1.49 + "HTMLAudioElement", 1.50 + "HTMLVideoElement", 1.51 + "Window", 1.52 + "XMLHttpRequest", 1.53 + "Navigator", 1.54 + "WebSocket", 1.55 + "Event", 1.56 + "IDBKeyRange", 1.57 + "CSSPageRule", 1.58 + "SVGPatternElement", 1.59 + ]; 1.60 + 1.61 +ctors.forEach(testConstructor); 1.62 +</script> 1.63 +</body> 1.64 +</html>