Fix "Display All Tags in This Library" (broken in fe186333b)

This commit is contained in:
Dan Stillman 2017-05-12 05:37:46 -04:00
parent 9de6a55bce
commit 5963c02dbb
2 changed files with 40 additions and 1 deletions

View file

@ -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;

View file

@ -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;