Fix renaming and clearing of colored tags
This commit is contained in:
parent
fe186333be
commit
3a8357cb95
4 changed files with 65 additions and 6 deletions
|
@ -356,7 +356,32 @@ describe("Tag Selector", function () {
|
|||
|
||||
var tags = getRegularTags();
|
||||
assert.include(tags, newTag);
|
||||
})
|
||||
});
|
||||
|
||||
it("should rename a non-matching colored tag and update the tag selector", function* () {
|
||||
yield selectLibrary(win);
|
||||
|
||||
var oldTag = Zotero.Utilities.randomString();
|
||||
var newTag = Zotero.Utilities.randomString();
|
||||
|
||||
var libraryID = Zotero.Libraries.userLibraryID;
|
||||
var promise = waitForTagSelector(win);
|
||||
yield Zotero.Tags.setColor(libraryID, oldTag, "#F3F3F3");
|
||||
yield promise;
|
||||
|
||||
var tagSelector = doc.getElementById('zotero-tag-selector');
|
||||
promise = waitForTagSelector(win);
|
||||
var promptPromise = waitForWindow("chrome://global/content/commonDialog.xul", function (dialog) {
|
||||
dialog.document.getElementById('loginTextbox').value = newTag;
|
||||
dialog.document.documentElement.acceptDialog();
|
||||
})
|
||||
yield tagSelector.rename(oldTag);
|
||||
yield promise;
|
||||
|
||||
var tags = getColoredTags();
|
||||
assert.notInclude(tags, oldTag);
|
||||
assert.include(tags, newTag);
|
||||
});
|
||||
})
|
||||
|
||||
describe("#_openColorPickerWindow()", function () {
|
||||
|
|
|
@ -69,7 +69,7 @@ describe("Zotero.Tags", function () {
|
|||
describe("#setColor()", function () {
|
||||
var libraryID;
|
||||
|
||||
before(function* () {
|
||||
beforeEach(function* () {
|
||||
libraryID = Zotero.Libraries.userLibraryID;
|
||||
|
||||
// Clear library tag colors
|
||||
|
@ -97,5 +97,20 @@ describe("Zotero.Tags", function () {
|
|||
assert.lengthOf(o, 2);
|
||||
assert.sameMembers(o.map(c => c.color), [aColor, bColor]);
|
||||
});
|
||||
|
||||
it("should clear color for a tag", function* () {
|
||||
var aColor = '#ABCDEF';
|
||||
yield Zotero.Tags.setColor(libraryID, "A", aColor);
|
||||
var o = Zotero.Tags.getColor(libraryID, "A")
|
||||
assert.equal(o.color, aColor);
|
||||
assert.equal(o.position, 0);
|
||||
|
||||
yield Zotero.Tags.setColor(libraryID, "A", false);
|
||||
assert.equal(Zotero.Tags.getColors(libraryID).size, 0);
|
||||
assert.isFalse(Zotero.Tags.getColor(libraryID, "A"));
|
||||
|
||||
var o = Zotero.SyncedSettings.get(libraryID, 'tagColors');
|
||||
assert.isNull(o);
|
||||
});
|
||||
});
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue