Add tests for 'gr-avatar' when 'avatars' object is available
Change-Id: I4dbc6c2387fb7cfbd7dca8082dfb0727e5dc8aa0
diff --git a/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar_test.html b/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar_test.html
index b55a1c3..ae514ba 100644
--- a/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar_test.html
+++ b/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar_test.html
@@ -43,6 +43,36 @@
_account_id: 123
}),
'/accounts/123/avatar?s=16');
+ assert.equal(element._buildAvatarURL(
+ {
+ _account_id: 123,
+ avatars: [
+ {
+ url: 'https://cdn.example.com/s12-p/photo.jpg',
+ height: 12
+ },
+ {
+ url: 'https://cdn.example.com/s16-p/photo.jpg',
+ height: 16
+ },
+ {
+ url: 'https://cdn.example.com/s100-p/photo.jpg',
+ height: 100
+ },
+ ],
+ }),
+ 'https://cdn.example.com/s16-p/photo.jpg');
+ assert.equal(element._buildAvatarURL(
+ {
+ _account_id: 123,
+ avatars: [
+ {
+ url: 'https://cdn.example.com/s95-p/photo.jpg',
+ height: 95
+ },
+ ],
+ }),
+ '/accounts/123/avatar?s=16');
});
test('dom for existing account', function() {