parent
10cae22c55
commit
0d3d4323b5
2 changed files with 28 additions and 2 deletions
|
@ -94,7 +94,16 @@ Zotero.Translate.Sandbox = {
|
|||
Zotero.debug("Translate: WARNING: Zotero.Item#complete() called after Zotero.done(); please fix your code", 2);
|
||||
}
|
||||
|
||||
const allowedObjects = ["complete", "attachments", "seeAlso", "creators", "tags", "notes"];
|
||||
const allowedObjects = [
|
||||
"complete",
|
||||
"attachments",
|
||||
"creators",
|
||||
"tags",
|
||||
"notes",
|
||||
"relations",
|
||||
// Is this still needed?
|
||||
"seeAlso"
|
||||
];
|
||||
|
||||
// Create a new object here, so that we strip the "complete" property
|
||||
var newItem = {};
|
||||
|
|
|
@ -221,7 +221,24 @@ describe("Zotero.Translate", function() {
|
|||
assert.equal(note3.getNote(), "standalone note");
|
||||
checkTestTags(note3);
|
||||
});
|
||||
|
||||
|
||||
it('should save relations', async function () {
|
||||
var item = await createDataObject('item');
|
||||
var itemURI = Zotero.URI.getItemURI(item);
|
||||
let myItem = {
|
||||
itemType: "book",
|
||||
title: "Test Item",
|
||||
relations: {
|
||||
"dc:relation": [itemURI]
|
||||
}
|
||||
};
|
||||
let newItems = await saveItemsThroughTranslator("import", [myItem]);
|
||||
var relations = newItems[0].getRelations();
|
||||
assert.lengthOf(Object.keys(relations), 1);
|
||||
assert.lengthOf(relations["dc:relation"], 1);
|
||||
assert.equal(relations["dc:relation"][0], itemURI);
|
||||
});
|
||||
|
||||
it('should save collections', function* () {
|
||||
let translate = new Zotero.Translate.Import();
|
||||
translate.setString("");
|
||||
|
|
Loading…
Reference in a new issue