simple script tests

This commit is contained in:
Vincent Sanders 2012-07-30 22:31:20 +01:00
parent 72fe92d9ca
commit f207f14be1
7 changed files with 89 additions and 0 deletions

34
test/js/assorted.html Normal file
View File

@ -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>

17
test/js/index.html Normal file
View File

@ -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>

View File

@ -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>

View File

@ -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>

12
test/js/sync-script.html Normal file
View File

@ -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>

1
test/js/tst.css Normal file
View File

@ -0,0 +1 @@
h1 { color:red; }

1
test/js/tst.js Normal file
View File

@ -0,0 +1 @@
document.write("<script>document.write(\"Hello World\");</script>");