]> git.mxchange.org Git - friendica-addons.git/blob - js_upload/file-uploader/tests/test-handler-queue.htm
EN_GB translation of blockem addon THX Andy H3
[friendica-addons.git] / js_upload / file-uploader / tests / test-handler-queue.htm
1 <!DOCTYPE HTML>
2 <html>
3 <head>  
4     <script src="jquery-1.4.2.min.js" type="text/javascript"></script>
5     
6     <link href="qunit/qunit/qunit.css" rel="stylesheet" type="text/css" media="screen" />
7     <script src="qunit/qunit/qunit.js" type="text/javascript"></script>
8     
9     <script src="../client/fileuploader.js" type="text/javascript" ></script>
10     <script>
11 jQuery(function(){
12
13     function getHandler(){
14         if(qq.UploadHandlerXhr.isSupported()){           
15             return qq.UploadHandlerXhr;                        
16         } else {
17             return qq.UploadHandlerForm;
18         }
19     }    
20
21     asyncTest("upload", function() {                                      
22             expect(2);
23                             
24             var data = {stringOne: 'rtdfghdfhfh',stringTwo: 'dfsgsdfgsdg',stringThree: 'dfsgfhdfhdg'};
25             var savedId;
26                                                     
27             var uploadHandler = new (getHandler())({
28                 action: 'action-handler-queue-test.php',
29                 maxConnections: 1,
30                 onComplete: function(id, fileName, response){
31                     if (!response.success){
32                         ok(false, 'server did not receive file')
33                         return;    
34                     }
35                     
36                     delete response.success;
37                     delete response.qqfile;
38                     
39                     same(response, data, 'server received file and data');                                                              
40                 }
41             });
42                 
43                 
44             $('#testinput1, #testinput2').change(upload);    
45             
46             function upload(){
47                 setTimeout(start, 9000);
48                 
49                 var file = this;
50                 if (uploadHandler instanceof qq.UploadHandlerXhr){
51                     file = this.files[0];
52                 }
53                 var id = uploadHandler.add(file);        
54                 uploadHandler.upload(id, data);                
55             }
56             
57             
58     });
59 });
60     </script>  
61 </head>
62 <body> 
63     <h1 id="qunit-header">File uploader tests</h1> 
64     <h2 id="qunit-banner"></h2> 
65     <h2 id="qunit-userAgent"></h2> 
66     <ol id="qunit-tests"></ol>
67
68         
69     <p>
70         Please select a file for each input below,
71         should be less than 4 sec, between selection.
72     </p>
73
74     
75     <input id="testinput1" type="file">
76     <input id="testinput2" type="file">
77         
78 </body> 
79 </html>
80
81