diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2006-09-30 14:34:49 +0000 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2006-09-30 14:34:49 +0000 |
commit | 308d771dd1973015166f0ac3b6cc7d538f7911c4 (patch) | |
tree | 76d4eefc4182886fa041b6c2c0f0e270205e6ca0 /build | |
parent | cc5625067a6bb75d357181cf6483ae0ab367c73f (diff) | |
download | jquery-308d771dd1973015166f0ac3b6cc7d538f7911c4.tar.gz jquery-308d771dd1973015166f0ac3b6cc7d538f7911c4.zip |
Refactored and fixed test suite to run async tests
Diffstat (limited to 'build')
-rw-r--r-- | build/test/data/json.php | 8 | ||||
-rw-r--r-- | build/test/data/name.php | 22 | ||||
-rw-r--r-- | build/test/data/test.js | 1 | ||||
-rw-r--r-- | build/test/data/testrunner.js | 2 | ||||
-rw-r--r-- | build/test/index.html | 8 | ||||
-rw-r--r-- | build/test/test.js | 7 |
6 files changed, 43 insertions, 5 deletions
diff --git a/build/test/data/json.php b/build/test/data/json.php new file mode 100644 index 000000000..31668cf29 --- /dev/null +++ b/build/test/data/json.php @@ -0,0 +1,8 @@ +<?php
+$json = $_REQUEST['json'];
+if($json) {
+ echo '[ {"name": "John", "age": 21}, {"name": "Peter", "age": 25 } ]';
+} else {
+ echo '{ "data": {"lang": "en", "length": 25} }';
+}
+?>
\ No newline at end of file diff --git a/build/test/data/name.php b/build/test/data/name.php new file mode 100644 index 000000000..a287fc92f --- /dev/null +++ b/build/test/data/name.php @@ -0,0 +1,22 @@ +<?php
+$wait = $_REQUEST['wait'];
+if($wait) {
+ sleep($wait);
+}
+$xml = $_REQUEST['xml'];
+if($xml) {
+ header("Content-type: text/xml");
+ eval("\$result = $xml;");
+ echo "<math><calculation>$xml</calculation><result>$result</result></math>";
+ die();
+}
+$name = $_REQUEST['name'];
+if($name == 'foo') {
+ echo "bar";
+ die();
+} else if($name == 'peter') {
+ echo "pan";
+ die();
+}
+echo "ERROR";
+?>
\ No newline at end of file diff --git a/build/test/data/test.js b/build/test/data/test.js new file mode 100644 index 000000000..2764fe107 --- /dev/null +++ b/build/test/data/test.js @@ -0,0 +1 @@ +foobar = "bar";
diff --git a/build/test/data/testrunner.js b/build/test/data/testrunner.js index db97215be..11921f9c7 100644 --- a/build/test/data/testrunner.js +++ b/build/test/data/testrunner.js @@ -50,8 +50,8 @@ function runTest(tests) { } function test(name, callback) { - Test = []; synchronize(function() { + Test = []; try { callback(); } catch(e) { diff --git a/build/test/index.html b/build/test/index.html index 2124948a6..048eec17c 100644 --- a/build/test/index.html +++ b/build/test/index.html @@ -34,9 +34,9 @@ <p id="first">Try them out:</p>
<ul id="firstUL"></ul> <ol id="empty"></ol> - <form id="form" action="formaction"> - <input type="text" value="Test" name="action" id="text1"/> - <input type="text" value="Test" id="text2" disabled="disabled"/> + <form id="form" action="formaction">
+ <input type="text" name="action" value="Test" id="text1"/> + <input type="text" name="text2" value="Test" id="text2" disabled="disabled"/> <input type="radio" name="radio1" id="radio1"/> <input type="radio" name="radio2" id="radio2" checked/> @@ -48,6 +48,8 @@ <input type="text" id="name" name="name" value="name" />
+ <button id="button" name="button">Button</button>
+
<textarea id="area1">foobar</textarea>
<select name="select1" id="select1">
diff --git a/build/test/test.js b/build/test/test.js index 0a2b0427c..4a6f0c2f6 100644 --- a/build/test/test.js +++ b/build/test/test.js @@ -28,7 +28,12 @@ for ( var i = 0; i < jq.length; i++ ) { if ( jq[i].tests.length > 0 ) { var method = jq[i]; var name = addParams(method.name, method.params); - testFile[testFile.length] = addTestWrapper(name, method.tests.join("\n").decode()); + for(var j = 0; j < method.tests.length; j++) { + if(j > 0) { + name += "x"; + } + testFile[testFile.length] = addTestWrapper(name, method.tests[j].decode()) + "\n"; + } } } |