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 #23805 from arcturus/bug-1064256
Browse files Browse the repository at this point in the history
Bug 1064256 - [Contacts] "TypeError: iceGroup is null" r=sergi
  • Loading branch information
arcturus committed Sep 11, 2014
2 parents 2f4d1d1 + 780c5f1 commit 84fe309
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
8 changes: 5 additions & 3 deletions apps/communications/contacts/js/views/list.js
Expand Up @@ -841,15 +841,17 @@ contacts.List = (function() {
}

function displayICEIndicator(ids) {
if (!iceGroup) {
buildICEGroup();
}

if (!ids || ids.length === 0) {
hideICEGroup();
return;
}

iceContacts = ids;
if (iceGroup === null) {
buildICEGroup();
}

showICEGroup();
}

Expand Down
22 changes: 22 additions & 0 deletions apps/communications/contacts/test/unit/views/list_test.js
Expand Up @@ -1724,12 +1724,34 @@ suite('Render contacts list', function() {
this.sinon.spy(MockAlphaScroll, 'hideGroup');
});

test('> ICE group is always build but is hidden', function() {
var stub = ICEStore.getContacts;
ICEStore.getContacts = function() {
return {
then: function(cb) {
cb();
}
};
};

mockContacts = new MockContactsList();
subject.load(mockContacts);
// ICE group created, even if we don't have contacts
var iceGroup = document.getElementById('section-group-ice');
assert.isNotNull(iceGroup);
// ICE group not visible
assert.isTrue(iceGroup.classList.contains('hide'));

ICEStore.getContacts = stub;
});

test('Display the ICE group if ICE contacts present', function() {
mockContacts = new MockContactsList();
subject.load(mockContacts);
// Check ice group present
var iceGroup = document.getElementById('section-group-ice');
assert.isNotNull(iceGroup);
assert.isFalse(iceGroup.classList.contains('hide'));
// Check that we are displaying the extra item in the alphascroll
sinon.assert.calledOnce(MockAlphaScroll.showGroup);
sinon.assert.calledWith(MockAlphaScroll.showGroup, 'ice');
Expand Down
2 changes: 1 addition & 1 deletion tests/python/gaia-ui-tests/gaiatest/apps/contacts/app.py
Expand Up @@ -23,7 +23,7 @@ class Contacts(Base):
_status_message_locator = (By.ID, 'statusMsg')

# contacts
_contact_locator = (By.CSS_SELECTOR, 'li.contact-item')
_contact_locator = (By.CSS_SELECTOR, 'li.contact-item:not([data-group="ice"])')

def launch(self):
Base.launch(self)
Expand Down

0 comments on commit 84fe309

Please sign in to comment.