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:
Dan Stillman 2016-07-06 02:04:53 -04:00
parent fc857dc496
commit 5740d4729d
2 changed files with 3 additions and 14 deletions

View file

@ -385,7 +385,7 @@ function createUnsavedDataObject(objectType, params = {}) {
}
if (objectType == 'search') {
obj.addCondition('title', 'contains', 'test');
obj.addCondition('title', 'contains', Zotero.Utilities.randomString());
}
Zotero.Utilities.assignProps(obj, params, allowedParams);

View file

@ -418,19 +418,8 @@ describe("Zotero.ItemTreeView", function() {
});
it("should update search results when items are added", function* () {
var search = createUnsavedDataObject('search');
var title = Zotero.Utilities.randomString();
search.fromJSON({
name: "Test",
conditions: [
{
condition: "title",
operator: "is",
value: title
}
]
});
yield search.saveTx();
var search = yield createDataObject('search');
var title = search.getConditions()[0].value;
yield waitForItemsLoad(win);
assert.equal(zp.itemsView.rowCount, 0);