Commit e159ec00 authored by Tristan Cavelier's avatar Tristan Cavelier Committed by Sebastien Robin

Updating Qunit tests.

parent ddf0bcf9
...@@ -22,6 +22,21 @@ var getXML = function (url) { ...@@ -22,6 +22,21 @@ var getXML = function (url) {
$.ajax({'url':url,async:false, $.ajax({'url':url,async:false,
dataType:'text',success:function(xml){tmp=xml;}}); dataType:'text',success:function(xml){tmp=xml;}});
return tmp; return tmp;
},
addPath = function (path) {
var array = LocalOrCookieStorage.getItem ('jio/localfilearray') || [];
array.push(path);
LocalOrCookieStorage.setItem ('jio/localfilearray',array);
},
removePath = function (path) {
var array = LocalOrCookieStorage.getItem ('jio/localfilearray') || [],
newarray = [], i;
for (i = 0; i < array.length; i+= 1) {
if (array[i] !== path) {
newarray.push (array[i]);
}
}
LocalOrCookieStorage.setItem ('jio/localfilearray',newarray);
}; };
//// end tools //// end tools
...@@ -266,11 +281,11 @@ test ('Check name availability', function () { ...@@ -266,11 +281,11 @@ test ('Check name availability', function () {
{"ID":'noid'}); {"ID":'noid'});
// name must be available // name must be available
LocalOrCookieStorage.deleteItem ('jio/local/MrCheckName/jiotests/file'); removePath ('jio/local/MrCheckName/jiotests/file');
mytest(true); mytest(true);
// name must be unavailable // name must be unavailable
LocalOrCookieStorage.setItem ('jio/local/MrCheckName/jiotests/file',{}); addPath ('jio/local/MrCheckName/jiotests/file');
mytest(false); mytest(false);
o.jio.stop(); o.jio.stop();
...@@ -386,6 +401,8 @@ test ('Get document list', function () { ...@@ -386,6 +401,8 @@ test ('Get document list', function () {
'lastModified':1,'creationDate':0}; 'lastModified':1,'creationDate':0};
doc2 = {'fileName':'memo','fileContent':'test', doc2 = {'fileName':'memo','fileContent':'test',
'lastModified':5,'creationDate':2}; 'lastModified':5,'creationDate':2};
addPath ('jio/local/MrListName/jiotests/file');
addPath ('jio/local/MrListName/jiotests/memo');
LocalOrCookieStorage.setItem ('jio/local/MrListName/jiotests/file',doc1); LocalOrCookieStorage.setItem ('jio/local/MrListName/jiotests/file',doc1);
LocalOrCookieStorage.setItem ('jio/local/MrListName/jiotests/memo',doc2); LocalOrCookieStorage.setItem ('jio/local/MrListName/jiotests/memo',doc2);
delete doc1.fileContent; delete doc1.fileContent;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment