Restore colored tags at top of tag selector when not linked to item
This commit is contained in:
parent
9ffcd89303
commit
be04f3d33c
|
@ -244,6 +244,13 @@
|
||||||
.tap(() => Zotero.Promise.check(this.mode));
|
.tap(() => Zotero.Promise.check(this.mode));
|
||||||
tagsBox.textContent = "";
|
tagsBox.textContent = "";
|
||||||
|
|
||||||
|
// Add colored tags that aren't already real tags
|
||||||
|
let regularTags = new Set(this._tags.map(tag => tag.tag));
|
||||||
|
let coloredTags = new Set(tagColors.keys());
|
||||||
|
[for (x of coloredTags) if (!regularTags.has(x)) x].forEach(x =>
|
||||||
|
this._tags.push(Zotero.Tags.cleanData({ tag: x }))
|
||||||
|
);
|
||||||
|
|
||||||
// Sort by name
|
// Sort by name
|
||||||
let collation = Zotero.getLocaleCollation();
|
let collation = Zotero.getLocaleCollation();
|
||||||
this._tags.sort(function (a, b) {
|
this._tags.sort(function (a, b) {
|
||||||
|
|
|
@ -155,6 +155,18 @@ describe("Tag Selector", function () {
|
||||||
assert.equal(getRegularTags().length, 1);
|
assert.equal(getRegularTags().length, 1);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("should show a colored tag at the top of the list even when linked to no items", function* () {
|
||||||
|
var libraryID = Zotero.Libraries.userLibraryID;
|
||||||
|
|
||||||
|
var tagSelector = doc.getElementById('zotero-tag-selector');
|
||||||
|
var tagElems = tagSelector.id('tags-box').childNodes;
|
||||||
|
var count = tagElems.length;
|
||||||
|
|
||||||
|
yield Zotero.Tags.setColor(libraryID, "Top", '#AAAAAA');
|
||||||
|
|
||||||
|
assert.equal(tagElems.length, count + 1);
|
||||||
|
});
|
||||||
|
|
||||||
it("shouldn't re-insert a new tag that matches an existing color", function* () {
|
it("shouldn't re-insert a new tag that matches an existing color", function* () {
|
||||||
var libraryID = Zotero.Libraries.userLibraryID;
|
var libraryID = Zotero.Libraries.userLibraryID;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user