plupload
Version:
Plupload is a JavaScript API for dealing with file uploads it supports features like multiple file selection, file type filtering, request chunking, client side image scaling and it uses different runtimes to achieve this such as HTML 5, Silverlight and F
65 lines (50 loc) • 1.72 kB
HTML
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Plupload: Test</title>
<script src="../loader.js"></script>
<script type="text/javascript">
QUnit.config.reorder = false;
o.Env.swf_url = "../../js/flash/Moxie.swf";
o.Env.xap_url = "../../js/silverlight/Moxie.xap";
module("Plupload", {
setup: function() {
},
teardown: function() {
}
});
test("xmlEncode()", function() {
expect(1);
equal(plupload.xmlEncode("<tag>'string1'" + '&"string2"'), '<tag>'string1'&"string2"', "<>&'\" symbols encode properly");
});
test("predictRuntime()", function() {
var config = {
runtimes : 'html4,silverlight,flash,html5',
browse_button : 'pickfiles', // you can pass in id...
container: $('container'), // ... or DOM Element itself
multi_selection: true,
max_file_size : '10mb',
required_features: true,
url : 'upload.php',
flash_swf_url : '../js/Moxie.swf',
silverlight_xap_url : '../js/Moxie.xap',
filters : [
{title : "Image files", extensions : "jpg,gif,png"},
{title : "Zip files", extensions : "zip"}
]
};
equal(plupload.predictRuntime(config), 'silverlight', "Successfully handled typical Plupload config.");
config.runtimes = 'html4,flash,silverlight,html5';
equal(plupload.predictRuntime(config), 'flash', "Flash can access binary too.");
config.drop_element = 'container';
delete config.required_features;
equal(plupload.predictRuntime(config), 'html4', "Without options considered as required, html4 should be ok.");
});
</script>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture" style="position: relative; top: 0 !important; left: 0 !important; width: 100%; height: 9px;"></div>
</body>
</html>