Show "Duplicate Items" and "Unfiled Items" for all libraries by default

Previously they only showed for My Library by default, which I suspect
meant that most people didn't know you could get them for other
libraries...

This hides "Duplicate Items" and "Unfiled Items" from the context menu
when they're active, which may or may not be desirable (but we don't
show, say, "Trash" in the context menu).

Also tweaks selection behavior after hide to select next appropriate row
instead of the parent library.
This commit is contained in:
Dan Stillman 2016-07-01 05:48:19 -04:00
parent 51b3951fb0
commit 893b9ae1fc
6 changed files with 199 additions and 124 deletions

View file

@ -18,24 +18,20 @@ describe("Zotero.CollectionTreeView", function() {
});
describe("#refresh()", function () {
it("should show Duplicate Items and Unfiled Items in My Library by default", function* () {
it("should show Duplicate Items and Unfiled Items by default", function* () {
Zotero.Prefs.clear('duplicateLibraries');
Zotero.Prefs.clear('unfiledLibraries');
yield cv.refresh();
assert.ok(cv.getRowIndexByID("D" + userLibraryID));
assert.ok(cv.getRowIndexByID("U" + userLibraryID));
assert.equal(Zotero.Prefs.get('duplicateLibraries'), "" + userLibraryID);
assert.equal(Zotero.Prefs.get('unfiledLibraries'), "" + userLibraryID);
});
it("shouldn't show Duplicate Items and Unfiled Items if hidden", function* () {
Zotero.Prefs.set('duplicateLibraries', "");
Zotero.Prefs.set('unfiledLibraries', "");
Zotero.Prefs.set('duplicateLibraries', `{"${userLibraryID}": false}`);
Zotero.Prefs.set('unfiledLibraries', `{"${userLibraryID}": false}`);
yield cv.refresh();
assert.isFalse(cv.getRowIndexByID("D" + userLibraryID));
assert.isFalse(cv.getRowIndexByID("U" + userLibraryID));
assert.strictEqual(Zotero.Prefs.get('duplicateLibraries'), "");
assert.strictEqual(Zotero.Prefs.get('unfiledLibraries'), "");
});
it("should maintain open state of group", function* () {
@ -390,8 +386,8 @@ describe("Zotero.CollectionTreeView", function() {
yield createDataObject('collection', { libraryID: group.libraryID });
yield createDataObject('collection', { libraryID: group.libraryID });
// Group, collections, and trash
assert.equal(cv.rowCount, originalRowCount + 7);
// Group, collections, Duplicates, Unfiled, and trash
assert.equal(cv.rowCount, originalRowCount + 9);
var spy = sinon.spy(cv, "refresh");
try {