Fix potential error dragging to library that hasn't been loaded

https://forums.zotero.org/discussion/85136/unable-to-copy-items-between-libraries

Zotero.Relations.getByPredicateAndObject() is now async.
This commit is contained in:
Dan Stillman 2020-09-14 23:47:08 -04:00
parent 42e74fb8cc
commit 8fc316f727
7 changed files with 22 additions and 22 deletions

View file

@ -2,7 +2,7 @@
describe("Zotero.Relations", function () {
describe("#getByPredicateAndObject()", function () {
it("should return items matching predicate and object", function* () {
it("should return items matching predicate and object", async function () {
var item = createUnsavedDataObject('item');
item.setRelations({
"dc:relation": [
@ -13,8 +13,8 @@ describe("Zotero.Relations", function () {
"http://zotero.org/groups/1/items/GSMRRSSM"
]
})
yield item.saveTx();
var objects = Zotero.Relations.getByPredicateAndObject(
await item.saveTx();
var objects = await Zotero.Relations.getByPredicateAndObject(
'item', 'owl:sameAs', 'http://zotero.org/groups/1/items/SRRMGSRM'
);
assert.lengthOf(objects, 1);