commit 5740d4729da98f1c386bb390579d21da862006f0
parent fc857dc496415669f8cb58a3dcaad31801f5aa36
Author: Dan Stillman <dstillman@zotero.org>
Date: Wed, 6 Jul 2016 02:04:53 -0400
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
Diffstat:
2 files changed, 3 insertions(+), 14 deletions(-)
diff --git a/test/content/support.js b/test/content/support.js
@@ -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);
diff --git a/test/tests/itemTreeViewTest.js b/test/tests/itemTreeViewTest.js
@@ -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);