Map base fields to item-specific fields in Item#fromJSON()

This commit is contained in:
Simon Kornblith 2015-06-03 23:42:08 -04:00
parent 87db29f060
commit 7253a2dd8c
2 changed files with 16 additions and 2 deletions

View file

@ -739,4 +739,15 @@ describe("Zotero.Item", function () {
assert.isUndefined(json.numPages);
})
})
describe("#fromJSON()", function () {
it("should map a base field to an item-specific field", function* () {
var item = new Zotero.Item("bookSection");
yield item.fromJSON({
"itemType":"bookSection",
"publicationTitle":"Publication Title"
});
assert.equal(item.getField("bookTitle"), "Publication Title");
});
});
});