diff --git a/browserid/static/dialog/controllers/page_controller.js b/browserid/static/dialog/controllers/page_controller.js index 0a9361bf7bfaa55162dbe61401a5ac3a1386d17d..6904b0fb8655e5e19a6b3a98399796dff154e070 100644 --- a/browserid/static/dialog/controllers/page_controller.js +++ b/browserid/static/dialog/controllers/page_controller.js @@ -133,16 +133,6 @@ } }, - /** - * Immediately show the error dialog - * @method errorDialog - * @param {object} info - info to use for the error dialog. Should have - * two fields, message, description. - */ - errorDialog: function(info) { - this.renderError({title: info.message, message: info.description}); - }, - /** * Get a curried function to an error dialog. * @method getErrorDialog @@ -151,7 +141,7 @@ */ getErrorDialog: function(info) { var self=this; - return self.errorDialog.bind(self, info); + return self.renderError.bind(self, info); }, onCancel: function(event) { diff --git a/browserid/static/dialog/resources/error-messages.js b/browserid/static/dialog/resources/error-messages.js index dd7ee7313210e4a5dd20645c2c06ed030e77fd05..860760fb88febb0e2645a94dda23b3cf7f314b5f 100644 --- a/browserid/static/dialog/resources/error-messages.js +++ b/browserid/static/dialog/resources/error-messages.js @@ -38,44 +38,44 @@ BrowserID.Errors = (function(){ var Errors = { authentication: { type: "serverError", - message: "Error Authenticating", - description: "There was a technical problem while trying to log you in. Yucky!" + title: "Error Authenticating", + message: "There was a technical problem while trying to log you in. Yucky!" }, addEmail: { type: "serverError", - message: "Error Adding Address", - description: "There was a technical problem while trying to add this email to your account. Yucky!" + title: "Error Adding Address", + message: "There was a technical problem while trying to add this email to your account. Yucky!" }, checkAuthentication: { type: "serverError", - message: "Error Checking Authentication", - description: "There was a technical problem while trying to log you in. Yucky!" + title: "Error Checking Authentication", + message: "There was a technical problem while trying to log you in. Yucky!" }, createAccount: { type: "serverError", - message: "Error Creating Account", - description: "There was a technical problem while trying to create your account. Yucky!" + title: "Error Creating Account", + message: "There was a technical problem while trying to create your account. Yucky!" }, registration: { type: "serverError", - message: "Registration Failed", - description: "An error was encountered and the signup cannot be completed. Yucky!" + title: "Registration Failed", + message: "An error was encountered and the signup cannot be completed. Yucky!" }, signIn: { type: "serverError", - message: "Signin Failed", - description: "There was an error signing in. Yucky!" + title: "Signin Failed", + message: "There was an error signing in. Yucky!" }, syncAddress: { type: "serverError", - message: "Error Syncing Address", - description: "There was a technical problem while trying to synchronize your account. Yucky!" + title: "Error Syncing Address", + message: "There was a technical problem while trying to synchronize your account. Yucky!" } }; diff --git a/browserid/static/dialog/test/qunit/controllers/page_controller_unit_test.js b/browserid/static/dialog/test/qunit/controllers/page_controller_unit_test.js index 92ed30efcfb848c7a7a5ce79fb0913374b1fdc14..fca829d5c917981be1272ff7ee2148d1f089fa5c 100644 --- a/browserid/static/dialog/test/qunit/controllers/page_controller_unit_test.js +++ b/browserid/static/dialog/test/qunit/controllers/page_controller_unit_test.js @@ -100,7 +100,7 @@ steal.plugins("jquery").then("/dialog/controllers/page_controller", function() { ok(html.length, "with wait template specified, wait text is loaded"); }); - test("renderError does what it is meant to", function() { + test("renderError renders an error message", function() { controller = el.page({ waitTemplate: waitTemplate, waitVars: { @@ -109,14 +109,38 @@ steal.plugins("jquery").then("/dialog/controllers/page_controller", function() { } }).controller(); - el.page("renderError", { + controller.renderError({ title: "error title", message: "error message" }); var html = el.find("#error .contents").html(); + // XXX underpowered test, we don't actually check the contents. ok(html.length, "with error template specified, error text is loaded"); }); + test("getErrorDialog gets a function that can be used to render an error message", function() { + controller = el.page({ + waitTemplate: waitTemplate, + waitVars: { + title: "Test title", + message: "Test message" + } + }).controller(); + + var func = controller.getErrorDialog({ + title: "error title", + message: "error message" + }); + + equal(typeof func, "function", "a function was returned from getErrorDialog"); + func(); + + var html = el.find("#error .contents").html(); + // XXX underpowered test, we don't actually check the contents. + ok(html.length, "when function is run, error text is loaded"); + + }); + });