Use random title in search condition in createDataObject() test function
Can be retrieved with search.getConditions()[0].value and included in an item title to have an item match the created search
This commit is contained in:
parent
fc857dc496
commit
5740d4729d
2 changed files with 3 additions and 14 deletions
|
@ -385,7 +385,7 @@ function createUnsavedDataObject(objectType, params = {}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (objectType == 'search') {
|
if (objectType == 'search') {
|
||||||
obj.addCondition('title', 'contains', 'test');
|
obj.addCondition('title', 'contains', Zotero.Utilities.randomString());
|
||||||
}
|
}
|
||||||
|
|
||||||
Zotero.Utilities.assignProps(obj, params, allowedParams);
|
Zotero.Utilities.assignProps(obj, params, allowedParams);
|
||||||
|
|
|
@ -418,19 +418,8 @@ describe("Zotero.ItemTreeView", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should update search results when items are added", function* () {
|
it("should update search results when items are added", function* () {
|
||||||
var search = createUnsavedDataObject('search');
|
var search = yield createDataObject('search');
|
||||||
var title = Zotero.Utilities.randomString();
|
var title = search.getConditions()[0].value;
|
||||||
search.fromJSON({
|
|
||||||
name: "Test",
|
|
||||||
conditions: [
|
|
||||||
{
|
|
||||||
condition: "title",
|
|
||||||
operator: "is",
|
|
||||||
value: title
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
yield search.saveTx();
|
|
||||||
|
|
||||||
yield waitForItemsLoad(win);
|
yield waitForItemsLoad(win);
|
||||||
assert.equal(zp.itemsView.rowCount, 0);
|
assert.equal(zp.itemsView.rowCount, 0);
|
||||||
|
|
Loading…
Reference in a new issue