Don't accept keyboard input before new-collection prompt appears

Fixes #1613
This commit is contained in:
Dan Stillman 2018-12-27 07:11:15 -05:00
parent 4bc8fab4f5
commit 7575cd8b29
5 changed files with 92 additions and 44 deletions

View file

@ -203,13 +203,23 @@ describe("Zotero.Utilities.Internal", function () {
describe("#getNextName()", function () {
it("should get the next available numbered name", function () {
var existing = ['Name (1)', 'Name (3)'];
assert.equal(Zotero.Utilities.Internal.getNextName('Name', existing), 'Name (4)');
var existing = ['Name', 'Name 1', 'Name 3'];
assert.equal(Zotero.Utilities.Internal.getNextName('Name', existing), 'Name 2');
});
it("should return 'Name (1)' if no numbered names", function () {
it("should return 'Name 1' if no numbered names", function () {
var existing = ['Name'];
assert.equal(Zotero.Utilities.Internal.getNextName('Name', existing), 'Name (1)');
assert.equal(Zotero.Utilities.Internal.getNextName('Name', existing), 'Name 1');
});
it("should return 'Name' if only numbered names", function () {
var existing = ['Name 1', 'Name 3'];
assert.equal(Zotero.Utilities.Internal.getNextName('Name', existing), 'Name');
});
it("should trim given name if trim=true", function () {
var existing = ['Name', 'Name 1', 'Name 2', 'Name 3'];
assert.equal(Zotero.Utilities.Internal.getNextName('Name 2', existing, true), 'Name 4');
});
});
})