Fix hang in collectionsTreeView::selectWait() if row is already selected

This commit is contained in:
Dan Stillman 2015-05-25 01:43:07 -04:00
parent 43762248a4
commit cbbdebc5b7
6 changed files with 19 additions and 4 deletions

View file

@ -41,6 +41,7 @@ function loadBrowserWindow() {
*/
var loadZoteroPane = Zotero.Promise.coroutine(function* () {
var win = yield loadBrowserWindow();
Zotero.Prefs.clear('lastViewedFolder');
win.ZoteroOverlay.toggleDisplay(true);
// Hack to wait for pane load to finish. This is the same hack

View file

@ -49,7 +49,7 @@ describe("Zotero.CollectionTreeView", function() {
})
})
describe("#selectByID", function () {
describe("#selectByID()", function () {
it("should select the trash", function* () {
yield collectionsView.selectByID("T1");
var row = collectionsView.selection.currentIndex;
@ -59,6 +59,15 @@ describe("Zotero.CollectionTreeView", function() {
})
})
describe("#selectWait()", function () {
it("shouldn't hang if row is already selected", function* () {
var row = collectionsView.getRowByID("T" + Zotero.Libraries.userLibraryID);
collectionsView.selection.select(row);
yield Zotero.Promise.delay(50);
yield collectionsView.selectWait(row);
})
})
describe("#notify()", function () {
it("should select a new collection", function* () {
// Create collection

View file

@ -1,9 +1,10 @@
describe("Zotero.Items", function () {
var win, collectionsView;
var win, collectionsView, zp;
before(function* () {
win = yield loadZoteroPane();
collectionsView = win.ZoteroPane.collectionsView;
zp = win.ZoteroPane;
})
beforeEach(function () {
return selectLibrary(win);
@ -36,7 +37,7 @@ describe("Zotero.Items", function () {
assert.isFalse(yield Zotero.Items.getAsync(id1));
assert.isFalse(yield Zotero.Items.getAsync(id2));
assert.isFalse(yield Zotero.Items.getAsync(id3));
assert.equal(win.ZoteroPane.itemsView.rowCount, 0);
assert.equal(zp.itemsView.rowCount, 0);
})
})
});