about summary refs log tree commit diff stats
path: root/test
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-11-22 19:08:13 +0100
committerbptato <nincsnevem662@gmail.com>2024-11-22 20:06:25 +0100
commit7d549f10ba356486201645ae11fc4796ef5a4441 (patch)
tree4d5f0f12ee42597f7803907b519100e6793559f7 /test
parent309852b46d93bc33e5ddaa1c5c49d071f71f0900 (diff)
downloadchawan-7d549f10ba356486201645ae11fc4796ef5a4441.tar.gz
dom: add document named property getter, update monoucha
Diffstat (limited to 'test')
-rw-r--r--test/js/document.html33
1 files changed, 26 insertions, 7 deletions
diff --git a/test/js/document.html b/test/js/document.html
index 26dfa528..1020283c 100644
--- a/test/js/document.html
+++ b/test/js/document.html
@@ -1,11 +1,30 @@
 <!doctype html>
-<title>Window test</title>
+<title>Document test</title>
+<body>
 <div id="abc">Fail</div>
+<img id=img2 name=img3>
+<img id=toString name=a>
+<img id=img4 name=>
+<form id=myform name=asdf></form>
+<script src=asserts.js></script>
 <script>
-(function() {
-	if (document.toString() !== "[object Document]") return;
-	if (document !== window.document) return;
-	if (document.implementation !== document.implementation) return;
-	document.getElementById("abc").textContent = "Success";
-})()
+assertEquals(document.toString, document.getElementById("toString"));
+document.toString.remove();
+document.testtest = "hi";
+assertEquals(Object.getOwnPropertyNames(document).toString(), "testtest,location,img2,img3,asdf");
+// the spec doesn't have HTMLDocument, but browsers do.
+//TODO: we'll probably have to implement HTMLDocument ourselves too
+// nonetheless.
+if (!window.HTMLDocument)
+	assertEquals(document.toString(), "[object Document]");
+assertEquals(document, window.document);
+assertEquals(document.implementation, document.implementation);
+assertEquals(document.img2, document.getElementById("img2"));
+assertEquals(document.img3, document.getElementById("img2"));
+assertEquals(document.asdf, document.getElementById("myform"));
+assertEquals(document.img4, undefined);
+document.getElementById("img4").remove();
+document.asdf.remove();
+document.img2.remove();
+document.getElementById("abc").textContent = "Success";
 </script>