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

No longer use the email address as an element ID.

* Unit tests now check the displayed order of the addresses against the data model's sorted order.
parent 355f9e25
No related branches found
No related tags found
No related merge requests found
......@@ -90,8 +90,7 @@ BrowserID.manageAccount = (function() {
_(emails).each(function(item) {
var e = item.address;
var id = e.replace('@', '_').replace('.', '_', 'g');
var identity = substitute(template, { email: e, id: id });
var identity = substitute(template, { email: e });
var idEl = dom.appendTo(identity, list),
deleteButton = dom.getDescendentElements(".delete", idEl);
......
......@@ -9,6 +9,7 @@
var bid = BrowserID,
xhr = bid.Mocks.xhr,
errorScreen = bid.Screens.error,
user = bid.User,
network = bid.Network,
storage = bid.Storage,
testHelpers = bid.TestHelpers,
......@@ -82,12 +83,11 @@
xhr.useResult("multiple");
createController(mocks, function() {
equal($("#emailList").children().length, 2, "there two children added");
var firstLI = $("#testuser2_testuser_com");
var secondLI = $("#testuser_testuser_com");
equal(firstLI.next().is(secondLI), true, "names are in alphabetical order");
var sortedEmails = user.getSortedEmailKeypairs();
_.each(sortedEmails, function(addressInfo, index) {
var displayedAddress = $("#emailList .email").get(index).innerHTML;
equal(displayedAddress, addressInfo.address, "emails are displayed in sorted order");
});
start();
});
......
......@@ -19,13 +19,13 @@
</div>
</div>
<!--
<!--
These "templates" below aren't available as EJS client-side, since all
EJS tags are processed when this view is served by the server.
-->
<script type="text/html" id="templateUser">
<li class="identity cf" id="{{id}}">
<li class="identity cf">
<div class="email">{{email}}</div>
<button class="delete"><%- gettext('remove') %></button>
</li>
......
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