summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--html/ecmascript-isfinite.html37
-rw-r--r--html/ecmascript-isinteger.html36
-rw-r--r--monkey-test/ecmascript.yaml38
-rw-r--r--monkey-test/index.yaml3
4 files changed, 114 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>
diff --git a/monkey-test/ecmascript.yaml b/monkey-test/ecmascript.yaml
new file mode 100644
index 0000000..a08c9ce
--- /dev/null
+++ b/monkey-test/ecmascript.yaml
@@ -0,0 +1,38 @@
+title: Test ecmascript behaviour
+group: ecmascript
+steps:
+- action: launch
+ language: en
+- action: window-new
+ tag: win1
+
+# ensure isfinite works and is in both number and global context
+- action: navigate
+ window: win1
+ url: http://test.netsurf-browser.org/html/ecmascript-isfinite.html
+- action: block
+ conditions:
+ - window: win1
+ status: complete
+- action: plot-check
+ window: win1
+ checks:
+ - text-contains: "YESNOYESNO"
+
+# ensure isinteger works and is only in number context and not global
+- action: navigate
+ window: win1
+ url: http://test.netsurf-browser.org/html/ecmascript-isinteger.html
+- action: block
+ conditions:
+ - window: win1
+ status: complete
+- action: plot-check
+ window: win1
+ checks:
+ - text-contains: "YESNOReferenceError"
+
+- action: window-close
+ window: win1
+- action: quit
+
diff --git a/monkey-test/index.yaml b/monkey-test/index.yaml
index df10dbc..f23d69c 100644
--- a/monkey-test/index.yaml
+++ b/monkey-test/index.yaml
@@ -13,5 +13,8 @@
- group: https
description: Test HTTPS handling
+- group: ecmascript
+ description: ECMAScript tests
+
- group: popular-sites
description: Navigate popular web sites \ No newline at end of file