diff --git a/chrome/content/zotero/xpcom/data/searches.js b/chrome/content/zotero/xpcom/data/searches.js index 1b64006a4a..1189801454 100644 --- a/chrome/content/zotero/xpcom/data/searches.js +++ b/chrome/content/zotero/xpcom/data/searches.js @@ -198,7 +198,9 @@ Zotero.Searches = function () { search._conditions[id] = { id, condition: 'resultLevel', - mode: undefined, + // No mode -- parseCondition() uses false, and toJSON() only omits the + // "/mode" suffix for an exact false + mode: false, operator: 'item', value: '' }; diff --git a/test/tests/searchTest.js b/test/tests/searchTest.js index a079e8c19b..8bd81a2c0b 100644 --- a/test/tests/searchTest.js +++ b/test/tests/searchTest.js @@ -69,14 +69,15 @@ describe("Zotero.Search", function () { var resultLevel = conds.find(c => c.condition == 'resultLevel'); assert.ok(resultLevel); assert.equal(resultLevel.operator, 'item'); + assert.sameMembers(s.toJSON().conditions.map(c => c.condition), ['note', 'resultLevel']); assert.sameMembers(await s.search(), [item.id]); await item.eraseTx(); await s.eraseTx(); }); }); - - + + describe("#save()", function () { it("should fail without a name", async function () { var s = new Zotero.Search;