Don't match all attachments with annotations for "not" search conditions
Fixes #2867
This commit is contained in:
parent
fe016edf33
commit
3a77eb85ed
2 changed files with 44 additions and 5 deletions
|
@ -158,6 +158,23 @@ describe("Zotero.Search", function() {
|
|||
});
|
||||
|
||||
describe("Conditions", function () {
|
||||
describe("title", function () {
|
||||
// TEMP
|
||||
it("shouldn't match parent attachments with annotations for 'title' 'does not contain' condition", async function () {
|
||||
var attachment = await importPDFAttachment();
|
||||
var title = "Attachment Title";
|
||||
attachment.setField('title', title);
|
||||
await attachment.saveTx();
|
||||
await createAnnotation('highlight', attachment);
|
||||
|
||||
var s = new Zotero.Search();
|
||||
s.libraryID = userLibraryID;
|
||||
s.addCondition('title', 'doesNotContain', title);
|
||||
var matches = await s.search();
|
||||
assert.notInclude(matches, attachment.id);
|
||||
});
|
||||
});
|
||||
|
||||
describe("collection", function () {
|
||||
it("should find item in collection", function* () {
|
||||
var col = yield createDataObject('collection');
|
||||
|
@ -233,6 +250,21 @@ describe("Zotero.Search", function() {
|
|||
var matches = await s.search();
|
||||
assert.sameMembers(matches, [attachment.id]);
|
||||
});
|
||||
|
||||
// TEMP
|
||||
it("shouldn't match parent attachments with annotations for 'tag' 'is not' condition", async function () {
|
||||
var attachment = await importPDFAttachment();
|
||||
await createAnnotation('highlight', attachment);
|
||||
var tag = Zotero.Utilities.randomString();
|
||||
attachment.addTag(tag);
|
||||
await attachment.saveTx();
|
||||
|
||||
var s = new Zotero.Search();
|
||||
s.libraryID = userLibraryID;
|
||||
s.addCondition('tag', 'isNot', tag);
|
||||
var matches = await s.search();
|
||||
assert.notInclude(matches, attachment.id);
|
||||
});
|
||||
});
|
||||
|
||||
describe("dateAdded", function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue