diff options
author | Vincent Sanders <vince@kyllikki.org> | 2019-07-01 22:12:19 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2019-07-01 22:12:19 +0100 |
commit | 228eacf83d469994e4c4250a27d55f9a213234ed (patch) | |
tree | 4f9bd3c8299635fd13bbbf0e37190acc148440d8 /html | |
parent | 0ef3f41fb2b198df5be34a7c3b462b56f655a875 (diff) | |
download | netsurf-test-228eacf83d469994e4c4250a27d55f9a213234ed.tar.gz netsurf-test-228eacf83d469994e4c4250a27d55f9a213234ed.tar.bz2 |
add initial ecmascript tests
Diffstat (limited to 'html')
-rw-r--r-- | html/ecmascript-isfinite.html | 37 | ||||
-rw-r--r-- | html/ecmascript-isinteger.html | 36 |
2 files changed, 73 insertions, 0 deletions
diff --git a/html/ecmascript-isfinite.html b/html/ecmascript-isfinite.html new file mode 100644 index 0000000..6941c5d --- /dev/null +++ b/html/ecmascript-isfinite.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<html> +<head> +<title>test ecmascript Number.isFinite()</title> +</head> +<body> +<h1>test ecmascript Number.isFinite()</h1> + +<noscript><p>Javascript is disabled</p></noscript> +<script> + function div(x) { + if (Number.isFinite(1000 / x)) { + return 'NO'; + } + + return 'YES'; + } + function gdiv(x) { + if (isFinite(1000 / x)) { + return 'NO'; + } + + return 'YES'; + } + document.write("<p>"); + try { + document.write(div(0), div(1)); + document.write(gdiv(0), gdiv(1)); + } catch (e) { + document.write(e); + } + document.write("</p>"); + +</script> + +</body> +</html> diff --git a/html/ecmascript-isinteger.html b/html/ecmascript-isinteger.html new file mode 100644 index 0000000..0ca417f --- /dev/null +++ b/html/ecmascript-isinteger.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<html> +<head> +<title>test ecmascript Number.isInteger()</title> +</head> +<body> +<h1>test ecmascript Number.isInteger()</h1> + +<noscript><p>Javascript is disabled</p></noscript> +<script> + function fits(x, y) { + if (Number.isInteger(y / x)) { + return 'YES'; + } + return 'NO'; + } + function gfits(x, y) { + if (isInteger(y / x)) { + return 'YES'; + } + return 'NO'; + } + + document.write("<p>"); + try { + document.write(fits(5, 10), fits(5, 11)); + document.write(gfits(5, 10), gfits(5, 11)); + } catch (e) { + document.write(e); + } + document.write("</p>"); + +</script> + +</body> +</html> |