Don't bother opening browser window for syncLocal::checkUser() tests

The window is passed to nsIPromptService, which handles finding a parent window
(hidden or otherwise) automatically if necessary.
This commit is contained in:
Dan Stillman 2016-05-18 02:28:30 -04:00
parent 2c18968c3a
commit b9bbf007f0
2 changed files with 4 additions and 14 deletions

View File

@ -91,7 +91,7 @@ Zotero.Sync.Data.Local = {
* If user accepts, change the current user, delete existing groups, and update relation * If user accepts, change the current user, delete existing groups, and update relation
* URIs to point to the new user's library. * URIs to point to the new user's library.
* *
* @param {Window} * @param {Window|null}
* @param {Integer} userID - New userID * @param {Integer} userID - New userID
* @param {Integer} libraryID - New libraryID * @param {Integer} libraryID - New libraryID
* @return {Boolean} - True to continue, false to cancel * @return {Boolean} - True to continue, false to cancel

View File

@ -22,16 +22,6 @@ describe("Zotero.Sync.Data.Local", function() {
describe("#checkUser()", function () { describe("#checkUser()", function () {
var win;
beforeEach(function* () {
win = yield loadBrowserWindow();
});
afterEach(function () {
win.close();
});
it("should prompt for user update and perform on accept", function* () { it("should prompt for user update and perform on accept", function* () {
yield Zotero.Users.setCurrentUserID(1); yield Zotero.Users.setCurrentUserID(1);
yield Zotero.Users.setCurrentUsername("A"); yield Zotero.Users.setCurrentUsername("A");
@ -47,7 +37,7 @@ describe("Zotero.Sync.Data.Local", function() {
assert.equal(matches[3], "A"); assert.equal(matches[3], "A");
handled = true; handled = true;
}); });
var cont = yield Zotero.Sync.Data.Local.checkUser(win, 2, "B"); var cont = yield Zotero.Sync.Data.Local.checkUser(null, 2, "B");
assert.isTrue(handled); assert.isTrue(handled);
assert.isTrue(cont); assert.isTrue(cont);
@ -60,7 +50,7 @@ describe("Zotero.Sync.Data.Local", function() {
yield Zotero.Users.setCurrentUsername("A"); yield Zotero.Users.setCurrentUsername("A");
waitForDialog(false, 'cancel'); waitForDialog(false, 'cancel');
var cont = yield Zotero.Sync.Data.Local.checkUser(win, 2, "B"); var cont = yield Zotero.Sync.Data.Local.checkUser(null, 2, "B");
assert.isFalse(cont); assert.isFalse(cont);
assert.equal(Zotero.Users.getCurrentUserID(), 1); assert.equal(Zotero.Users.getCurrentUserID(), 1);
@ -80,7 +70,7 @@ describe("Zotero.Sync.Data.Local", function() {
yield item1.addLinkedItem(item2); yield item1.addLinkedItem(item2);
var cont = yield Zotero.Sync.Data.Local.checkUser(win, 1, "A"); var cont = yield Zotero.Sync.Data.Local.checkUser(null, 1, "A");
assert.isTrue(cont); assert.isTrue(cont);
var json = item1.toJSON(); var json = item1.toJSON();