diff options
author | bptato <nincsnevem662@gmail.com> | 2024-08-15 19:11:49 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-08-15 19:23:55 +0200 |
commit | 4bf895db711f3d4d229d3f18fbb2145cce2a73af (patch) | |
tree | 2e81c7399de03aebb9dfa166eba6ee809a75cd2e /test/net/xhr.html | |
parent | 885a3493b6cad4b4247a200928fe61e41883aaba (diff) | |
download | chawan-4bf895db711f3d4d229d3f18fbb2145cce2a73af.tar.gz |
xhr: more progress
* add responseText, response * add net tests -> currently sync XHR only; should find a way to do async tests... * update monoucha -> simplified & updated some related code that no longer worked properly
Diffstat (limited to 'test/net/xhr.html')
-rw-r--r-- | test/net/xhr.html | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/net/xhr.html b/test/net/xhr.html new file mode 100644 index 00000000..2d034772 --- /dev/null +++ b/test/net/xhr.html @@ -0,0 +1,20 @@ +<!doctype html> +<title>onclick setter/getter</title> +<div id=x>Fail</div> +<script src=asserts.js></script> +<script> +const x = new XMLHttpRequest(); +assert(x.onreadystatechange === null); +function myFunction() { + ; +} +x.onreadystatechange = myFunction; +assert(myFunction === x.onreadystatechange); +assert(x.readyState === XMLHttpRequest.UNSENT); +x.open("GET", "ping", false); +assert_throws("x.responseType = 'document'"); +x.send(); +assert_equals(x.readyState, XMLHttpRequest.DONE); +assert_equals(x.responseText.trim(), "pong"); +document.getElementById("x").textContent = "Success"; +</script> |