diff --git a/resources/static/dialog/views/primary_user_verified.ejs b/resources/static/dialog/views/primary_user_verified.ejs index 3432f4a135b27f137ea5760c3d708e11e585e0c2..b84e92fb5186c40f9aa82a0e8a033269fd51d8f8 100644 --- a/resources/static/dialog/views/primary_user_verified.ejs +++ b/resources/static/dialog/views/primary_user_verified.ejs @@ -15,10 +15,5 @@ <p><strong>Address Verified!</strong></p> Your identity has been verified with your email provider, we will now try to sign you in. </li> - - </ul> - - <div class="submit cf"> - </div> </div> diff --git a/resources/static/dialog/views/test_template_no_input.ejs b/resources/static/dialog/views/test_template_no_input.ejs new file mode 100644 index 0000000000000000000000000000000000000000..825dc5a89ae4ae28507c68f1625b0c327a2c5a5c --- /dev/null +++ b/resources/static/dialog/views/test_template_no_input.ejs @@ -0,0 +1,9 @@ +<!-- This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> + + +<%= gettext("translated text") %> + +<button id="focusButton">Button!</button> + diff --git a/resources/static/dialog/views/testBodyTemplate.ejs b/resources/static/dialog/views/test_template_with_input.ejs similarity index 100% rename from resources/static/dialog/views/testBodyTemplate.ejs rename to resources/static/dialog/views/test_template_with_input.ejs diff --git a/resources/static/shared/modules/page_module.js b/resources/static/shared/modules/page_module.js index 6ad214a3f01de6975d9363b9d97792bd7ed3c4de..d8d2c4b7f89065608d3078466780343bb7834b54 100644 --- a/resources/static/shared/modules/page_module.js +++ b/resources/static/shared/modules/page_module.js @@ -38,18 +38,6 @@ BrowserID.Modules.PageModule = (function() { var self=this; self.domEvents = []; - - if(options.bodyTemplate) { - self.renderDialog(options.bodyTemplate, options.bodyVars); - } - - if(options.waitTemplate) { - self.renderWait(options.waitTemplate, options.waitVars); - } - - if(options.errorTemplate) { - self.renderError(options.errorTemplate, options.errorVars); - } }, checkRequired: function(options) { @@ -116,6 +104,10 @@ BrowserID.Modules.PageModule = (function() { screens.form.show(template, data); dom.focus("input:visible:not(:disabled):eq(0)"); + // XXX jQuery. bleck. + if($("*:focus").length === 0) { + dom.focus("button:visible:eq(0)"); + } }, renderWait: showScreen.curry(screens.wait), diff --git a/resources/static/test/cases/shared/modules/page_module.js b/resources/static/test/cases/shared/modules/page_module.js index 4a00c35fb557db39a7502aa8b279b410d7067d4b..7db90097c54912a67da1d48541f5960803317827 100644 --- a/resources/static/test/cases/shared/modules/page_module.js +++ b/resources/static/test/cases/shared/modules/page_module.js @@ -7,7 +7,7 @@ "use strict"; var controller, el, - bodyTemplate = "testBodyTemplate", + bodyTemplate = "test_template_with_input", waitTemplate = "wait", bid = BrowserID, mediator = bid.Mediator; @@ -39,13 +39,12 @@ equal(html, "", "with no template specified, no text is loaded"); }); - test("page controller with body template renders in #formWrap .contents", function() { - createController({ - bodyTemplate: bodyTemplate, - bodyVars: { - title: "Test title", - message: "Test message" - } + test("renderDialog with template with input element - render the correct dialog, focus first input element", function() { + createController(); + + controller.renderDialog("test_template_with_input", { + title: "Test title", + message: "Test message" }); var html = el.find("#formWrap .contents").html(); @@ -55,38 +54,6 @@ equal(html, "", "with body template specified, wait text is not loaded"); }); - test("page controller with wait template renders in #wait .contents", function() { - createController({ - waitTemplate: waitTemplate, - waitVars: { - title: "Test title", - message: "Test message" - } - }); - - var html = el.find("#formWrap .contents").html(); - equal(html, "", "with wait template specified, form is ignored"); - - html = el.find("#wait .contents").html(); - ok(html.length, "with wait template specified, wait text is loaded"); - }); - - test("page controller with error template renders in #error .contents", function() { - createController({ - errorTemplate: waitTemplate, - errorVars: { - title: "Test title", - message: "Test message" - } - }); - - var html = el.find("#formWrap .contents").html(); - equal(html, "", "with error template specified, form is ignored"); - - html = el.find("#error .contents").html(); - ok(html.length, "with error template specified, error text is loaded"); - }); - test("renderError renders an error message", function() { createController(); diff --git a/resources/static/test/cases/shared/renderer.js b/resources/static/test/cases/shared/renderer.js index d65a20ecd4a4ee132b36d287d9fdb43ba7ee2451..2ac4b75c701fa3cb1723cdecc3ab63753ce44326 100644 --- a/resources/static/test/cases/shared/renderer.js +++ b/resources/static/test/cases/shared/renderer.js @@ -23,7 +23,7 @@ $("#formWrap .contents").empty(); $("#templateInput").remove(); - renderer.render("#formWrap .contents", "testBodyTemplate"); + renderer.render("#formWrap .contents", "test_template_with_input"); ok($("#templateInput").length, "template written when loaded using XHR"); }); diff --git a/resources/static/test/cases/shared/screens.js b/resources/static/test/cases/shared/screens.js index 6e227198c112e14d91da68261e632261753ce352..f34c1ae9aace7241df52afd5ca818fe6556e55f7 100644 --- a/resources/static/test/cases/shared/screens.js +++ b/resources/static/test/cases/shared/screens.js @@ -25,7 +25,7 @@ test("form", function() { el = $("#formWrap .contents"); el.empty(); - screens.form.show("testBodyTemplate"); + screens.form.show("test_template_with_input"); ok($("#templateInput").length, "the template has been written"); equal($("body").hasClass("form"), true, "form class added to body"); @@ -39,7 +39,7 @@ test("wait", function() { var el = $("#wait .contents"); el.empty(); - screens.wait.show("testBodyTemplate"); + screens.wait.show("test_template_with_input"); ok($("#templateInput").length, "the template has been written"); equal($("body").hasClass("waiting"), true, "waiting class added to body"); @@ -53,7 +53,7 @@ test("error", function() { var el = $("#error .contents"); el.empty(); - screens.error.show("testBodyTemplate"); + screens.error.show("test_template_with_input"); ok($("#templateInput").length, "the template has been written"); equal($("body").hasClass("error"), true, "error class added to body");