Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #10347 from arcturus/bug-880645
Browse files Browse the repository at this point in the history
Bug 880645 - [CONTACTS] Order by last name option doesn't work well when item count>500
  • Loading branch information
arcturus committed Jun 13, 2013
2 parents ffb2e62 + 0e846b4 commit 73095ca
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions apps/communications/contacts/js/contacts_list.js
Expand Up @@ -149,12 +149,12 @@ contacts.List = (function() {
scrollable.scrollTop = domTarget.offsetTop;
};

var load = function load(contacts) {
var load = function load(contacts, forceReset) {
var onError = function() {
console.log('ERROR Retrieving contacts');
};

if (loaded) {
if (loaded || forceReset) {
resetDom();
}

Expand Down
3 changes: 2 additions & 1 deletion apps/communications/contacts/js/contacts_settings.js
Expand Up @@ -511,7 +511,8 @@ contacts.Settings = (function() {
if (newOrderByLastName != null &&
newOrderByLastName != orderByLastName && contacts.List) {
contacts.List.setOrderByLastName(newOrderByLastName);
contacts.List.load();
// Force the reset of the dom, we know that we changed the order
contacts.List.load(null, true);
orderByLastName = newOrderByLastName;
}

Expand Down
12 changes: 11 additions & 1 deletion apps/communications/contacts/test/unit/contacts_list_test.js
Expand Up @@ -712,7 +712,17 @@ suite('Render contacts list', function() {
subject.remove('3');
assert.isFalse(noContacts.classList.contains('hide'));
assertNoGroup(groupFav, containerFav);
assertTotal(0, 0);
assertNoGroup(groupFav, containerFav);
});

test('reseting the dom of the contacts list', function() {
var newList = new MockContactsList();
subject.load(newList);

subject.load(null, true);

assertNoGroup(groupFav, containerFav);
assertNoGroup(groupFav, containerFav);
});

test('removing one contact', function() {
Expand Down

0 comments on commit 73095ca

Please sign in to comment.