Don't clear search field when updating items list during sync

Fixes #985
This commit is contained in:
Dan Stillman 2016-05-05 02:14:54 -04:00
parent 8c98abe9dc
commit 3ab335a078
2 changed files with 29 additions and 5 deletions

View file

@ -9,8 +9,8 @@ describe("Zotero.ItemTreeView", function() {
zp = win.ZoteroPane;
cv = zp.collectionsView;
var item = new Zotero.Item('book');
existingItemID = yield item.saveTx();
var item = yield createDataObject('item', { setTitle: true });
existingItemID = item.id;
});
beforeEach(function* () {
yield selectLibrary(win);
@ -137,6 +137,30 @@ describe("Zotero.ItemTreeView", function() {
assert.equal(selected[0], existingItemID);
});
it("shouldn't clear quicksearch if skipSelect is passed", function* () {
var searchString = Zotero.Items.get(existingItemID).getField('title');
yield createDataObject('item');
var quicksearch = win.document.getElementById('zotero-tb-search');
quicksearch.value = searchString;
quicksearch.doCommand();
yield itemsView._refreshPromise;
assert.equal(itemsView.rowCount, 1);
// Create item with skipSelect flag
var item = new Zotero.Item('book');
var ran = Zotero.Utilities.randomString();
item.setField('title', ran);
var id = yield item.saveTx({
skipSelect: true
});
assert.equal(itemsView.rowCount, 1);
assert.equal(quicksearch.value, searchString);
});
it("shouldn't change selection outside of trash if new trashed item is created with skipSelect", function* () {
yield selectLibrary(win);
yield waitForItemsLoad(win);