Add Feed and FeedItem

Also:
* _finalizeErase in Zotero.DataObject is now inheritable
* Call _initErase before starting a DB transaction
* removes Zotero.Libraries.add and Zotero.Libraries.remove (doesn't seem like this is used any more)
This commit is contained in:
Aurimas Vinckevicius 2015-06-01 23:29:40 -05:00
parent 76511eca08
commit 88ab129ffb
35 changed files with 3017 additions and 689 deletions

View file

@ -2,6 +2,7 @@ describe("Zotero.Items", function () {
var win, collectionsView, zp;
before(function* () {
this.timeout(10000);
win = yield loadZoteroPane();
collectionsView = win.ZoteroPane.collectionsView;
zp = win.ZoteroPane;
@ -114,4 +115,28 @@ describe("Zotero.Items", function () {
//assert.equal(zp.itemsView.rowCount, 0)
})
})
describe("#getAsync()", function() {
it("should return Zotero.Item for item ID", function* () {
let item = new Zotero.Item('journalArticle');
let id = yield item.saveTx();
item = yield Zotero.Items.getAsync(id);
assert.notOk(item.isFeedItem);
assert.instanceOf(item, Zotero.Item);
assert.notInstanceOf(item, Zotero.FeedItem);
});
it("should return Zotero.FeedItem for feed item ID", function* () {
let feed = new Zotero.Feed({ name: 'foo', url: 'http://www.' + Zotero.randomString() + '.com' });
yield feed.saveTx();
let feedItem = new Zotero.FeedItem('journalArticle', { guid: Zotero.randomString() });
feedItem.libraryID = feed.libraryID;
let id = yield feedItem.forceSaveTx();
feedItem = yield Zotero.Items.getAsync(id);
assert.isTrue(feedItem.isFeedItem);
assert.instanceOf(feedItem, Zotero.FeedItem);
});
});
});