plupload.html 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <title>Plupload: Test</title>
  6. <script src="../loader.js"></script>
  7. <script type="text/javascript">
  8. QUnit.config.reorder = false;
  9. o.Env.swf_url = "../../js/flash/Moxie.swf";
  10. o.Env.xap_url = "../../js/silverlight/Moxie.xap";
  11. module("Plupload", {
  12. setup: function() {
  13. },
  14. teardown: function() {
  15. }
  16. });
  17. test("xmlEncode()", function() {
  18. expect(1);
  19. equal(plupload.xmlEncode("<tag>'string1'" + '&"string2"'), '&lt;tag&gt;&#39;string1&#39;&amp;&quot;string2&quot;', "<>&'\" symbols encode properly");
  20. });
  21. test("predictRuntime()", function() {
  22. var config = {
  23. runtimes : 'html4,silverlight,flash,html5',
  24. browse_button : 'pickfiles', // you can pass in id...
  25. container: $('container'), // ... or DOM Element itself
  26. multi_selection: true,
  27. max_file_size : '10mb',
  28. required_features: true,
  29. url : 'upload.php',
  30. flash_swf_url : '../js/Moxie.swf',
  31. silverlight_xap_url : '../js/Moxie.xap',
  32. filters : [
  33. {title : "Image files", extensions : "jpg,gif,png"},
  34. {title : "Zip files", extensions : "zip"}
  35. ]
  36. };
  37. equal(plupload.predictRuntime(config), 'silverlight', "Successfully handled typical Plupload config.");
  38. config.runtimes = 'html4,flash,silverlight,html5';
  39. equal(plupload.predictRuntime(config), 'flash', "Flash can access binary too.");
  40. config.drop_element = 'container';
  41. delete config.required_features;
  42. equal(plupload.predictRuntime(config), 'html4', "Without options considered as required, html4 should be ok.");
  43. });
  44. </script>
  45. </head>
  46. <body>
  47. <div id="qunit"></div>
  48. <div id="qunit-fixture" style="position: relative; top: 0 !important; left: 0 !important; width: 100%; height: 9px;"></div>
  49. </body>
  50. </html>