summaryrefslogtreecommitdiff
path: root/test/js
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2012-07-30 22:31:20 +0100
committerVincent Sanders <vince@netsurf-browser.org>2012-07-30 22:54:14 +0100
commitf207f14be1e95d0c1fa1866decf2c07a119ba8fe (patch)
tree895237614c4881ccbcdc7742de07ec43ec4b8f09 /test/js
parent72fe92d9ca0d3ba06c56cc258575e42102d502c6 (diff)
downloadnetsurf-f207f14be1e95d0c1fa1866decf2c07a119ba8fe.tar.gz
netsurf-f207f14be1e95d0c1fa1866decf2c07a119ba8fe.tar.bz2
simple script tests
Diffstat (limited to 'test/js')
-rw-r--r--test/js/assorted.html34
-rw-r--r--test/js/index.html17
-rw-r--r--test/js/inline-doc-write-simple.html11
-rw-r--r--test/js/inline-doc-write.html13
-rw-r--r--test/js/sync-script.html12
-rw-r--r--test/js/tst.css1
-rw-r--r--test/js/tst.js1
7 files changed, 89 insertions, 0 deletions
diff --git a/test/js/assorted.html b/test/js/assorted.html
new file mode 100644
index 000000000..bb3d477bc
--- /dev/null
+++ b/test/js/assorted.html
@@ -0,0 +1,34 @@
+<html>
+<head><title>moo</title></head>
+<body>
+<script>
+var tree = (this ===window)
+console.log(tree);
+var string = "50";
+
+console.log(string + 100); // 50100
+console.log(+string + 100); // 150
+
+string = parseInt(string, 10);
+console.log(string + 100); // 150
+var binary = parseInt("110010", 2);
+console.log(binary); // 50
+
+function doSomething(param) {
+ param = param.toUpperCase(); // param is now a local variable
+ console.log(param);
+}
+var string = "test";
+
+/* note that string will be passed in by reference */
+doSomething(string); // TEST
+console.log(string); // test
+
+document.write("<p>Hello World!<p>");
+</script>
+<p>one</p>
+<script>document.write("<scr" +"ipt>document.write(\"Goodbye Cruel World\");</scri" + "pt>");</script>
+</script>
+<p>hi</p>
+</body>
+</html>
diff --git a/test/js/index.html b/test/js/index.html
new file mode 100644
index 000000000..22f602e7f
--- /dev/null
+++ b/test/js/index.html
@@ -0,0 +1,17 @@
+<html>
+<head>
+<title>Script Tests</title>
+<link rel="stylesheet" type="text/css" href="tst.css">
+</head>
+<body>
+<h1>Script Tests</h1>
+<ul>
+<li><a href="assorted.html">Assorted</a></li>
+<li><a href="inline-doc-write-simple.html">Simple docuemnt write</a></li>
+<li><a href="inline-doc-write.html">Script within inline script</a></li>
+<li><a href="sync-script.html">External syncronous script (with css)</a></li>
+
+
+</ul>
+</body>
+</html>
diff --git a/test/js/inline-doc-write-simple.html b/test/js/inline-doc-write-simple.html
new file mode 100644
index 000000000..17ad8eede
--- /dev/null
+++ b/test/js/inline-doc-write-simple.html
@@ -0,0 +1,11 @@
+<html>
+<head><title>Inline Script Simple Document Write</title></head>
+<body>
+<h1>Inline Script Simple Document Write</h1>
+<p>Before</p>
+<script>
+document.write("<p>Hello World!<p>");
+</script>
+<p>Afterwards</p>
+</body>
+</html>
diff --git a/test/js/inline-doc-write.html b/test/js/inline-doc-write.html
new file mode 100644
index 000000000..290256d20
--- /dev/null
+++ b/test/js/inline-doc-write.html
@@ -0,0 +1,13 @@
+<html>
+<head>
+<title>Inline Docuemnt Write Test</title>
+<link rel="stylesheet" type="text/css" href="tst.css">
+</head>
+<body>
+<h1>Inline Document Write Test</h1>
+<p>Before</p>
+<script>document.write("<scr" +"ipt>document.write(\"Goodbye Cruel World\");</scri" + "pt>");</script>
+</script>
+<p>Afterwards</p>
+</body>
+</html>
diff --git a/test/js/sync-script.html b/test/js/sync-script.html
new file mode 100644
index 000000000..e234fb480
--- /dev/null
+++ b/test/js/sync-script.html
@@ -0,0 +1,12 @@
+<html>
+<head>
+<title>Sync script Test</title>
+<link rel="stylesheet" type="text/css" href="tst.css">
+</head>
+<body>
+<h1>Sync script Test</h1>
+<p>Before</p>
+<script src="tst.js"></script>
+<p>Afterwards</p>
+</body>
+</html>
diff --git a/test/js/tst.css b/test/js/tst.css
new file mode 100644
index 000000000..6069f248a
--- /dev/null
+++ b/test/js/tst.css
@@ -0,0 +1 @@
+h1 { color:red; }
diff --git a/test/js/tst.js b/test/js/tst.js
new file mode 100644
index 000000000..10e3b9c7f
--- /dev/null
+++ b/test/js/tst.js
@@ -0,0 +1 @@
+document.write("<script>document.write(\"Hello World\");</script>");