Merge "ES6ify /gr-account-label/*"
diff --git a/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label.js b/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label.js
index e9f18df..9ebef82 100644
--- a/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label.js
+++ b/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label.js
@@ -29,9 +29,9 @@
},
},
- _computeAccountTitle: function(account) {
+ _computeAccountTitle(account) {
if (!account || (!account.name && !account.email)) { return; }
- var result = '';
+ let result = '';
if (account.name) {
result += account.name;
}
@@ -41,11 +41,11 @@
return result;
},
- _computeShowEmail: function(showEmail, account) {
+ _computeShowEmail(showEmail, account) {
return !!(showEmail && account && account.email);
},
- _computeEmailStr: function(account) {
+ _computeEmailStr(account) {
if (!account || !account.email) {
return '';
}
diff --git a/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_test.html b/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_test.html
index de7d6a3..2c43879 100644
--- a/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_test.html
+++ b/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_test.html
@@ -33,32 +33,32 @@
</test-fixture>
<script>
- suite('gr-account-label tests', function() {
- var element;
+ suite('gr-account-label tests', () => {
+ let element;
- setup(function() {
+ setup(() => {
stub('gr-rest-api-interface', {
- getConfig: function() { return Promise.resolve({}); },
- getLoggedIn: function() { return Promise.resolve(false); },
+ getConfig() { return Promise.resolve({}); },
+ getLoggedIn() { return Promise.resolve(false); },
});
element = fixture('basic');
});
- test('null guard', function() {
- assert.doesNotThrow(function() {
+ test('null guard', () => {
+ assert.doesNotThrow(() => {
element.account = null;
});
});
- test('missing email', function() {
+ test('missing email', () => {
assert.equal('', element._computeEmailStr({name: 'foo'}));
});
- test('computed fields', function() {
+ test('computed fields', () => {
assert.equal(element._computeAccountTitle(
{
name: 'Andrew Bonventre',
- email: 'andybons+gerrit@gmail.com'
+ email: 'andybons+gerrit@gmail.com',
}),
'Andrew Bonventre <andybons+gerrit@gmail.com>');
@@ -69,7 +69,7 @@
assert.equal(element._computeShowEmail(true,
{
name: 'Andrew Bonventre',
- email: 'andybons+gerrit@gmail.com'
+ email: 'andybons+gerrit@gmail.com',
}), true);
assert.equal(element._computeShowEmail(true,
@@ -88,6 +88,5 @@
element._computeEmailStr({name: 'test', email: 'test'}), '(test)');
assert.equal(element._computeEmailStr({email: 'test'}, ''), 'test');
});
-
});
</script>