about summary refs log tree commit diff stats
path: root/test/js/htmlcollection.html
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-04-21 21:26:27 +0200
committerbptato <nincsnevem662@gmail.com>2024-04-21 21:28:45 +0200
commite3d9ee2c6224cd30bf56e24f7988899e0e3985c1 (patch)
tree31116d7d751d058f32bf43313c12673423e8d8be /test/js/htmlcollection.html
parentba88f015ea500bcc574b621392c721ef2c9dbcd0 (diff)
downloadchawan-e3d9ee2c6224cd30bf56e24f7988899e0e3985c1.tar.gz
test: add js & layout tests
(Sadly some layout tests still fail.)
Diffstat (limited to 'test/js/htmlcollection.html')
-rw-r--r--test/js/htmlcollection.html22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/js/htmlcollection.html b/test/js/htmlcollection.html
new file mode 100644
index 00000000..6231237a
--- /dev/null
+++ b/test/js/htmlcollection.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<title>HTMLCollection test</title>
+<div class="abc">Fail</div>
+<style>style 1</style>
+<style>style 2</style>
+<style>style 3</style>
+<script>
+(function() {
+	const abc = document.getElementsByClassName("abc");
+	if (abc.length !== 1) return;
+	abc[0].className = "defg";
+	if (abc.length !== 0) return;
+	const styles = document.getElementsByTagName("style");
+	if (styles.length !== 3) return;
+	if (styles[0].textContent !== "style 1") return;
+	if (styles[1].textContent !== "style 2") return;
+	if (styles[2].textContent !== "style 3") return;
+	for (const style of styles) style.remove();
+	let defg = document.getElementsByClassName("defg");
+	defg[0].textContent = "Success";
+})()
+</script>