Commit 1a8758a3 authored by Vincent Bechu's avatar Vincent Bechu Committed by Vincent Bechu

[indexeddbstorage] Fix putAttachment for empty blob

/reviewed-on !74
parent 2fddffaf
...@@ -385,7 +385,9 @@ ...@@ -385,7 +385,9 @@
end_index -= 1; end_index -= 1;
} }
function resolver(result) { function resolver(result) {
result_list.push(result); if (result.blob !== undefined) {
result_list.push(result);
}
resolve(result_list); resolve(result_list);
} }
function getPart(i) { function getPart(i) {
......
...@@ -1357,6 +1357,33 @@ ...@@ -1357,6 +1357,33 @@
}); });
}); });
test("retrieve empty blob", function () {
var context = this,
attachment = "attachment",
blob = new Blob();
stop();
expect(1);
deleteIndexedDB(context.jio)
.then(function () {
return context.jio.put("foo", {"title": "bar"});
})
.then(function () {
return context.jio.putAttachment("foo", attachment, blob);
})
.then(function () {
return context.jio.getAttachment("foo", attachment);
})
.then(function (result) {
deepEqual(result, blob, "check empty blob");
})
.fail(function (error) {
ok(false, error);
})
.always(function () {
start();
});
});
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// indexeddbStorage.removeAttachment // indexeddbStorage.removeAttachment
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
......
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