Commit 40807a96 authored by Phil Hughes's avatar Phil Hughes

Lazy load avatars in diffs

Adds the lazy attribute to lazy load avatars in merge request diffs.
parent 020110b3
......@@ -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