Permalink
Browse files

Bug 826216 if carrier is not defined for a phone number undefined is …

…shown
  • Loading branch information...
1 parent b1a1a99 commit ab305e97dce1b83d0635bc77fda1f0b4b3e01f83 @jmcanterafonseca jmcanterafonseca committed with samjoch Jan 3, 2013
@@ -339,7 +339,7 @@ contacts.Details = (function() {
var telField = {
value: utils.text.escapeHTML(currentTel.value, true) || '',
type: escapedType || TAG_OPTIONS['phone-type'][0].value,
- carrier: utils.text.escapeHTML(currentTel.carrier, true) || '',
+ carrier: utils.text.escapeHTML(currentTel.carrier || '', true) || '',
i: tel
};
var template = utils.templates.render(phonesTemplate, telField);
@@ -306,6 +306,23 @@ suite('Render contact', function() {
assert.include(container.innerHTML, mockContact.tel[0].type);
});
+ test('with 1 phone and carrier undefined', function() {
+ var contactNoCarrier = new MockContactAllFields();
+ contactNoCarrier.tel = [
+ {
+ value: '+34678987123',
+ type: ['Personal']
+ }
+ ];
+ subject.setContact(contactNoCarrier);
+ subject.render(null, TAG_OPTIONS);
+ var phoneButton = container.querySelector('#call-or-pick-0');
+ assert.equal(phoneButton.querySelector('b').textContent,
+ contactNoCarrier.tel[0].value);
+ var carrierContent = phoneButton.querySelector('em').textContent;
+ assert.lengthOf(carrierContent, 0);
+ });
+
test('with no phones', function() {
var contactWoTel = new MockContactAllFields();
contactWoTel.tel = [];

0 comments on commit ab305e9

Please sign in to comment.