Throw an error if item type isn't set when saving

And add a test for throwing from setField(), which already happens.
This commit is contained in:
Dan Stillman 2015-05-06 04:16:54 -04:00
parent 7879e5432a
commit 26e1372f46
2 changed files with 10 additions and 2 deletions

View file

@ -19,6 +19,11 @@ describe("Zotero.Item", function () {
});
describe("#setField", function () {
it("should throw an error if item type isn't set", function* () {
var item = new Zotero.Item;
assert.throws(item.setField.bind(item, 'title', 'test'), "Item type must be set before setting field data");
})
it("should mark a field as changed", function () {
var item = new Zotero.Item('book');
item.setField('title', 'Foo');