Skip to content
Snippets Groups Projects
Commit 9486d273 authored by Shane Tomlinson's avatar Shane Tomlinson
Browse files

Adding the TOS/PP to the Add Email screen.

issue #1316
parent 7847a4d1
No related branches found
No related tags found
No related merge requests found
......@@ -32,9 +32,13 @@ BrowserID.Modules.AddEmail = (function() {
var Module = bid.Modules.PageModule.extend({
start: function(options) {
var self=this;
var self=this,
templateData = helpers.extend({}, options, {
privacy_url: options.privacyURL || null,
tos_url: options.tosURL || null
});
self.renderDialog("add_email", options);
self.renderDialog("add_email", templateData);
self.click("#cancel", cancelAddEmail);
Module.sc.start.call(self, options);
......
......@@ -253,6 +253,11 @@ BrowserID.State = (function() {
});
subscribe("add_email", function(msg, info) {
info = helpers.extend(info || {}, {
privacyURL: self.privacyURL,
tosURL: self.tosURL
});
startState("doAddEmail", info);
});
......
......@@ -30,8 +30,22 @@
</ul>
<div class="submit cf">
<% if (privacy_url && tos_url) { %>
<p class="tospp">
<%= format(
gettext('By clicking %s, you confirm that you accept this site\'s <a %s>Terms of Use</a> and <a %s>Privacy Policy</a>.'),
[ gettext('add'),
format(' href="%s" target="_new"', [tos_url]),
format(' href="%s" target="_new"', [privacy_url])
]) %>
</p>
<p>
<% } %>
<button id="addNewEmail"><%= gettext('add') %></button>
<a href="#" id="cancel"><%= gettext('cancel') %></a>
<% if (privacy_url && tos_url) { %>
</p>
<% } %>
</div>
</div>
......
......@@ -11,7 +11,6 @@
bid = BrowserID,
user = bid.User,
xhr = bid.Mocks.xhr,
//provisioning = bid.Mocks.Provisioning,
modules = bid.Modules,
testHelpers = bid.TestHelpers,
register = testHelpers.register;
......@@ -38,13 +37,22 @@
function createController(options) {
controller = modules.AddEmail.create();
controller.start(options);
controller.start(options || {});
}
test("privacyURL and tosURL specified - show TOS/PP", function() {
equal($(".tospp").length, 0, "tospp has not yet been added to the DOM");
createController({
privacyURL: "http://testuser.com/priv.html",
tosURL: "http://testuser.com/tos.html",
});
equal($(".tospp").length, 1, "tospp has been added to the DOM");
});
test("addEmail with specified email address - fill in email", function() {
createController({ email: "testuser@testuser.com" });
ok($("#newEmail").val(), "testuser@testuser.com", "email prepopulated");
});
asyncTest("addEmail with valid unknown secondary email", function() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment