Guard against account being null
gr-message.html#149 uses message.reviewer, which may be null. Bug: Issue 5072 Change-Id: I1f63b078720a68ee29a4d876c09f18790b20f535
This commit is contained in:
@@ -46,6 +46,9 @@
|
||||
},
|
||||
|
||||
_computeEmailStr: function(account) {
|
||||
if (!account || !account.email) {
|
||||
return '';
|
||||
}
|
||||
if (account.name) {
|
||||
return '(' + account.email + ')';
|
||||
}
|
||||
|
||||
@@ -42,6 +42,16 @@ limitations under the License.
|
||||
element = fixture('basic');
|
||||
});
|
||||
|
||||
test('null guard', function() {
|
||||
assert.doesNotThrow(function() {
|
||||
element.account = null;
|
||||
});
|
||||
});
|
||||
|
||||
test('missing email', function() {
|
||||
assert.equal('', element._computeEmailStr({name: 'foo'}));
|
||||
});
|
||||
|
||||
test('computed fields', function() {
|
||||
assert.equal(element._computeAccountTitle(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user