Commit ef0f0d7e authored by Jacques Erasmus's avatar Jacques Erasmus

Merge branch 'ph/lazyLoadAvatarsOnDiffs' into 'master'

Lazy load avatars in diffs

See merge request gitlab-org/gitlab!67142
parents 0249cdee 40807a96
......@@ -75,6 +75,7 @@ export default {
:key="note.id"
:img-src="note.author.avatar_url"
:tooltip-text="getTooltipText(note)"
lazy
class="diff-comment-avatar js-diff-comment-avatar"
@click.native="$emit('toggleLineDiscussions')"
/>
......
......@@ -392,6 +392,7 @@ export default {
:img-src="author.avatar_url"
:img-alt="author.name"
:img-size="40"
lazy
>
<template #avatar-badge>
<slot name="avatar-badge"></slot>
......
......@@ -30,6 +30,11 @@ export default {
GlTooltip: GlTooltipDirective,
},
props: {
lazy: {
type: Boolean,
required: false,
default: false,
},
linkHref: {
type: String,
required: false,
......@@ -91,6 +96,7 @@ export default {
:size="imgSize"
:tooltip-text="avatarTooltipText"
:tooltip-placement="tooltipPlacement"
:lazy="lazy"
>
<slot></slot> </user-avatar-image
><span
......
......@@ -104,4 +104,15 @@ describe('User Avatar Link Component', () => {
);
});
});
describe('lazy', () => {
it('passes lazy prop to avatar image', () => {
createWrapper({
username: '',
lazy: true,
});
expect(wrapper.find(UserAvatarImage).props('lazy')).toBe(true);
});
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment