diff --git a/resources/static/dialog/controllers/verify_primary_user.js b/resources/static/dialog/controllers/verify_primary_user.js index 35334c5793941b7234fbaece4dffe6f614eff261..5721e82c03224f117b5e0c687e6cdd6203f38403 100644 --- a/resources/static/dialog/controllers/verify_primary_user.js +++ b/resources/static/dialog/controllers/verify_primary_user.js @@ -13,6 +13,7 @@ BrowserID.Modules.VerifyPrimaryUser = (function() { email, auth_url, helpers = bid.Helpers, + complete = helpers.complete, cancelEvent = helpers.Dialog.cancelEvent; function verify(callback) { @@ -29,7 +30,7 @@ BrowserID.Modules.VerifyPrimaryUser = (function() { win.document.location = url; - callback(); + complete(callback); } function cancel(callback) { diff --git a/resources/static/test/cases/controllers/verify_primary_user.js b/resources/static/test/cases/controllers/verify_primary_user.js index 9dfe74a0a91c5f37565438b54c7c5a90472c464e..de8da5ad94b8b5f25064f5499011a2ecad185421 100644 --- a/resources/static/test/cases/controllers/verify_primary_user.js +++ b/resources/static/test/cases/controllers/verify_primary_user.js @@ -74,6 +74,25 @@ }); }); + test("submit with no callback", function() { + createController({ + window: win, + add: true, + email: "unregistered@testuser.com", + auth_url: "http://testuser.com/sign_in" + }); + + var error; + try { + controller.submit(); + } + catch(e) { + error = e; + } + + equal(typeof error, "undefined", "error is undefined"); + }); + asyncTest("cancel triggers the cancel_state", function() { createController({ window: win,