Commit 91bcd115 authored by Romain Courteaud's avatar Romain Courteaud

query: sort_on must handle null value

parent 3fa67001
......@@ -47,7 +47,7 @@
value = [value];
}
for (i = 0; i < value.length; i += 1) {
if (typeof value[i] === 'object') {
if ((value[i] !== null) && (typeof value[i] === 'object')) {
new_value[i] = value[i].content;
} else {
new_value[i] = value[i];
......
......@@ -710,4 +710,28 @@
}).always(start);
});
test('sort_on options do not raise in case of null value', function () {
var doc_list = [
{'a': null},
{'c': 3},
{'b': 2}
];
stop();
expect(1);
jIO.QueryFactory.create("").exec(
doc_list,
{
sort_on: [['a', 'ascending']],
}
)
.then(function (list) {
deepEqual(list, [
{'c': 3},
{'b': 2},
{'a': null}
], 'Sorting didn\'t raise');
}).always(start);
});
}(jIO, jiodate));
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