diff options
author | Friendika <info@friendika.com> | 2011-01-26 00:34:39 -0800 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-01-26 00:34:39 -0800 |
commit | 2fc89deaeae0341aa12b6b811927e793011055d1 (patch) | |
tree | 32673c6b92cbe14f88d955de585ce813988ec5fa /addon/js_upload/file-uploader/tests/test-handler-queue.htm | |
parent | abbd498a8b6c92ddcf211a27dd532f2ec6520fe2 (diff) | |
download | volse-hubzilla-2fc89deaeae0341aa12b6b811927e793011055d1.tar.gz volse-hubzilla-2fc89deaeae0341aa12b6b811927e793011055d1.tar.bz2 volse-hubzilla-2fc89deaeae0341aa12b6b811927e793011055d1.zip |
work in progress js_uploader plugin, turn java uploader into plugin - not done yet
Diffstat (limited to 'addon/js_upload/file-uploader/tests/test-handler-queue.htm')
-rw-r--r-- | addon/js_upload/file-uploader/tests/test-handler-queue.htm | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/addon/js_upload/file-uploader/tests/test-handler-queue.htm b/addon/js_upload/file-uploader/tests/test-handler-queue.htm new file mode 100644 index 000000000..52e3b3a58 --- /dev/null +++ b/addon/js_upload/file-uploader/tests/test-handler-queue.htm @@ -0,0 +1,81 @@ +<!DOCTYPE HTML> +<html> +<head> + <script src="jquery-1.4.2.min.js" type="text/javascript"></script> + + <link href="qunit/qunit/qunit.css" rel="stylesheet" type="text/css" media="screen" /> + <script src="qunit/qunit/qunit.js" type="text/javascript"></script> + + <script src="../client/fileuploader.js" type="text/javascript" ></script> + <script> +jQuery(function(){ + + function getHandler(){ + if(qq.UploadHandlerXhr.isSupported()){ + return qq.UploadHandlerXhr; + } else { + return qq.UploadHandlerForm; + } + } + + asyncTest("upload", function() { + expect(2); + + var data = {stringOne: 'rtdfghdfhfh',stringTwo: 'dfsgsdfgsdg',stringThree: 'dfsgfhdfhdg'}; + var savedId; + + var uploadHandler = new (getHandler())({ + action: 'action-handler-queue-test.php', + maxConnections: 1, + onComplete: function(id, fileName, response){ + if (!response.success){ + ok(false, 'server did not receive file') + return; + } + + delete response.success; + delete response.qqfile; + + same(response, data, 'server received file and data'); + } + }); + + + $('#testinput1, #testinput2').change(upload); + + function upload(){ + setTimeout(start, 9000); + + var file = this; + if (uploadHandler instanceof qq.UploadHandlerXhr){ + file = this.files[0]; + } + var id = uploadHandler.add(file); + uploadHandler.upload(id, data); + } + + + }); +}); + </script> +</head> +<body> + <h1 id="qunit-header">File uploader tests</h1> + <h2 id="qunit-banner"></h2> + <h2 id="qunit-userAgent"></h2> + <ol id="qunit-tests"></ol> + + + <p> + Please select a file for each input below, + should be less than 4 sec, between selection. + </p> + + + <input id="testinput1" type="file"> + <input id="testinput2" type="file"> + +</body> +</html> + + |