Commit bf969260 authored by Aurel's avatar Aurel

Merge branch 'master' into erp5toerp5

Conflicts:
	src/jio.storage/replicatestorage.js
	test/jio.storage/replicatestorage.tests.js
parents 9d4d2411 d83a1306
# purpose of placing this file is to allow this folder to
# accessible for anonymous users inside testnode's apache
# frontend.
# Without this file by automatic unit testing will not work
Require all granted
......@@ -41,7 +41,7 @@ each method, please refer to the documentation):
```javascript
// create and store new document
jio_instance.put({"title": "some title"})
jio_instance.post({"title": "some title"})
.then(function (new_id) {
...
});
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "jio",
"version": "v3.11.0",
"version": "v3.13.0",
"license": "LGPLv3",
"author": "Nexedi SA",
"contributors": [
......@@ -42,6 +42,8 @@
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-uglify": "0.2.x",
"grunt-contrib-qunit": "~0.3.0",
"qunitjs": "~1.23.1",
"qunit-tap": "1.5.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-jslint": "~1.0.0",
"lz-string": "^1.4.4",
......
......@@ -124,6 +124,9 @@
i,
value,
result_list;
if (obj === undefined) {
return undefined;
}
if (obj.constructor === Object) {
key_list = Object.keys(obj).sort();
result_list = [];
......@@ -150,6 +153,9 @@
// https://gist.github.com/davoclavo/4424731
function dataURItoBlob(dataURI) {
if (dataURI === 'data:') {
return new Blob();
}
// convert base64 to raw binary data held in a string
var byteString = atob(dataURI.split(',')[1]),
// separate out the mime component
......
......@@ -447,7 +447,7 @@
ERP5Storage.prototype.hasCapacity = function (name) {
return ((name === "list") || (name === "query") ||
(name === "select") || (name === "limit") ||
(name === "sort"));
(name === "sort")) || (name === "bulk_get");
};
function isSingleLocalRoles(parsed_query) {
......@@ -496,7 +496,7 @@
sub_query,
result_list,
local_roles,
tmp_list = [];
sort_list = [];
if (options.query) {
parsed_query = jIO.QueryFactory.create(options.query);
......@@ -540,9 +540,8 @@
if (options.sort_on) {
for (i = 0; i < options.sort_on.length; i += 1) {
tmp_list.push(JSON.stringify(options.sort_on[i]));
sort_list.push(JSON.stringify(options.sort_on[i]));
}
options.sort_on = tmp_list;
}
return jIO.util.ajax({
......@@ -553,7 +552,7 @@
// XXX Force erp5 to return embedded document
select_list: options.select_list || ["title", "reference"],
limit: options.limit,
sort_on: options.sort_on,
sort_on: sort_list,
local_roles: local_roles
}),
"xhrFields": {
......
......@@ -28,9 +28,11 @@
*/
/*jslint nomen: true */
/*global indexedDB, jIO, RSVP, Blob, Math, IDBKeyRange*/
/*global indexedDB, jIO, RSVP, Blob, Math, IDBKeyRange, IDBOpenDBRequest,
DOMError, Event*/
(function (indexedDB, jIO, RSVP, Blob, Math, IDBKeyRange) {
(function (indexedDB, jIO, RSVP, Blob, Math, IDBKeyRange, IDBOpenDBRequest,
DOMError) {
"use strict";
// Read only as changing it can lead to data corruption
......@@ -89,7 +91,14 @@
if (request.result) {
request.result.close();
}
if ((error !== undefined) &&
(error.target instanceof IDBOpenDBRequest) &&
(error.target.error instanceof DOMError)) {
reject("Connection to: " + db_name + " failed: " +
error.target.error.message);
} else {
reject(error);
}
};
request.onabort = function () {
......@@ -450,4 +459,4 @@
};
jIO.addStorage("indexeddb", IndexedDBStorage);
}(indexedDB, jIO, RSVP, Blob, Math, IDBKeyRange));
}(indexedDB, jIO, RSVP, Blob, Math, IDBKeyRange, IDBOpenDBRequest, DOMError));
This diff is collapsed.
This diff is collapsed.
......@@ -20,6 +20,7 @@
'"2006-01-02T15:04:05.000Z"');
equal(str({ x: 5, y: 6, z: 7 }), '{"x":5,"y":6,"z":7}');
equal(str({ z: 7, y: 6, x: 5 }), '{"x":5,"y":6,"z":7}');
equal(str({ z: "", y: undefined, x: 5 }), '{"x":5,"z":""}');
equal(str(Object.create(null, { x: { value: 'x', enumerable: false },
y: { value: 'y', enumerable: true } })),
'{"y":"y"}');
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jIO in WebWorker Tests</title>
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css" type="text/css" media="screen"/>
</head>
<body>
<div id="qunit"></div>
<script src="../node_modules/qunitjs/qunit/qunit.js" type="text/javascript"></script>
<script>
QUnit.config.autorun = false;
</script>
<script src="webworker.js"></script>
</body>
</html>
/*global QUnit, Worker, console*/
(function (QUnit) {
"use strict";
var worker = new Worker("webworker.tests.js");
//queue = new RSVP.Queue();
worker.onerror = function (event) {
console.log(event);
};
worker.onmessage = function (event) {
var parsed_data = JSON.parse(event.data),
//callbacks = QUnit.config[parsed_data.method],
callbacks = QUnit.config.callbacks[parsed_data.method],
i,
start;
if (parsed_data.method) {
if (parsed_data.method === 'tap') {
start = parsed_data.data.slice(0, 6);
if (start === "not ok") {
console.log(parsed_data.data);
}
} else {
for (i = 0; i < callbacks.length; i += 1) {
callbacks[i](parsed_data.data);
}
if (parsed_data.method === 'done') {
worker.terminate();
}
}
}
};
}(QUnit));
/*global self, QUnit, qunitTap, importScripts*/
var global = self,
window = self;
(function (self) {
"use strict";
self.DOMParser = {};
self.DOMError = {};
self.sessionStorage = {};
self.localStorage = {};
self.openDatabase = {};
importScripts(
"../node_modules/rsvp/dist/rsvp-2.0.4.js",
"../dist/jio-latest.js"
);
self.exports = self;
importScripts("../node_modules/qunitjs/qunit/qunit.js");
self.exports = undefined;
//QUnit.config.autorun = false;
//QUnit.config.testTimeout = 5000;
importScripts("../node_modules/sinon/pkg/sinon.js");
importScripts("../node_modules/qunit-tap/lib/qunit-tap.js");
qunitTap(QUnit, function (data) {
self.postMessage(JSON.stringify({
method: 'tap',
data: data
}));
});
function createCallback(logType) {
QUnit[logType](function (data) {
self.postMessage(JSON.stringify({
method: logType,
data: data
}));
});
}
var i,
logs = [
"begin",
"testStart",
"testDone",
"log",
"moduleStart",
"moduleDone",
"done"
];
for (i = 0; i < logs.length; i += 1) {
createCallback(logs[i]);
}
// queries/key.tests.js needs it
//self.module = QUnit.module;
//self.test = QUnit.test;
//self.stop = QUnit.stop;
//self.start = QUnit.start;
//self.ok = QUnit.ok;
//self.expect = QUnit.expect;
//self.deepEqual = QUnit.deepEqual;
//self.equal = QUnit.equal;
importScripts(
//"jio/util.js",
//"queries/key.tests.js",
//"queries/key-schema.tests.js",
//"queries/tests.js",
//"queries/key-typechecks.tests.js",
//"queries/jiodate.tests.js",
//"queries/key-jiodate.tests.js",
//"jio.storage/querystorage.tests.js",
//"jio.storage/uuidstorage.tests.js",
//"jio.storage/replicatestorage.tests.js",
//"jio.storage/unionstorage.tests.js",
//"jio.storage/shastorage.tests.js",
//"jio.storage/cryptstorage.tests.js",
//"jio.storage/zipstorage.tests.js",
"jio.storage/indexeddbstorage.tests.js"
);
QUnit.load();
}(self));
\ No newline at end of file
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