diff --git a/chrome/content/zotero/bindings/tagselector.xml b/chrome/content/zotero/bindings/tagselector.xml index d8a0476c62..36f43ff127 100644 --- a/chrome/content/zotero/bindings/tagselector.xml +++ b/chrome/content/zotero/bindings/tagselector.xml @@ -268,7 +268,7 @@ // Otherwise just update based on visibility else { // If only a few tags, regenerate buttons from scratch - if (Object.keys(this.scope).length <= 100) { + if (this.filterToScope && Object.keys(this.scope).length <= 100) { // If full set is currently displayed, store it for later if (!this._tagsDiv) { this._tagsDiv = tagsBox.firstChild; diff --git a/test/tests/tagSelectorTest.js b/test/tests/tagSelectorTest.js index 3e184ecfb8..436474bb12 100644 --- a/test/tests/tagSelectorTest.js +++ b/test/tests/tagSelectorTest.js @@ -100,6 +100,45 @@ describe("Tag Selector", function () { }); }); + + describe("#filterToScope", function () { + it("should show all tags in library when false", function* () { + var tagSelector = doc.getElementById('zotero-tag-selector'); + tagSelector.filterToScope = false; + + var collection = yield createDataObject('collection'); + var item1 = createUnsavedDataObject('item'); + item1.setTags([ + { + tag: "A" + } + ]); + var item2 = createUnsavedDataObject('item', { collections: [collection.id] }); + item2.setTags([ + { + tag: "B" + } + ]); + var item3 = createUnsavedDataObject('item', { collections: [collection.id] }); + item3.setTags([ + { + tag: "C" + } + ]); + var promise = waitForTagSelector(win); + yield Zotero.DB.executeTransaction(function* () { + yield item1.save(); + yield item2.save(); + yield item3.save(); + }); + yield promise; + + var tags = getRegularTags(); + assert.sameMembers(tags, ['A', 'B', 'C']); + }); + }); + + describe("#notify()", function () { it("should add a tag when added to an item in the library root", function* () { var promise, tagSelector;