diff options
author | bptato <nincsnevem662@gmail.com> | 2024-04-21 21:26:27 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-04-21 21:28:45 +0200 |
commit | e3d9ee2c6224cd30bf56e24f7988899e0e3985c1 (patch) | |
tree | 31116d7d751d058f32bf43313c12673423e8d8be /test/js/class.html | |
parent | ba88f015ea500bcc574b621392c721ef2c9dbcd0 (diff) | |
download | chawan-e3d9ee2c6224cd30bf56e24f7988899e0e3985c1.tar.gz |
test: add js & layout tests
(Sadly some layout tests still fail.)
Diffstat (limited to 'test/js/class.html')
-rw-r--r-- | test/js/class.html | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/js/class.html b/test/js/class.html new file mode 100644 index 00000000..7c14049e --- /dev/null +++ b/test/js/class.html @@ -0,0 +1,23 @@ +<!doctype html> +<title>Element class test</title> +<div class="a b c">Fail</div> +<script> +(function() { + let div = document.getElementsByClassName("a")[0] + const classes = ["a", "b", "c"]; + let cl = div.classList; + for (let i = 0; i < classes.length; ++i) { + if (cl[i] !== classes[i]) + return; + } + const classes2 = ["x", "y", "z"]; + div.setAttribute("class", classes2.join(' ')); + let i = 0; + for (let x of cl) { + if (x != classes2[i]) + return; + ++i; + } + div.textContent = "Success"; +})(); +</script> |