File tree 2 files changed +19
-0
lines changed
static/app/components/avatar
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { ActorFixture } from 'sentry-fixture/actor' ;
1
2
import { OrganizationFixture } from 'sentry-fixture/organization' ;
2
3
import { ProjectFixture } from 'sentry-fixture/project' ;
3
4
import { SentryAppFixture } from 'sentry-fixture/sentryApp' ;
@@ -174,6 +175,15 @@ describe('Avatar', function () {
174
175
) ;
175
176
} ) ;
176
177
178
+ it ( 'can display a actor Avatar' , function ( ) {
179
+ const actor = ActorFixture ( ) ;
180
+
181
+ render ( < AvatarComponent actor = { actor } /> ) ;
182
+
183
+ expect ( screen . getByTestId ( `letter_avatar-avatar` ) ) . toBeInTheDocument ( ) ;
184
+ expect ( screen . getByText ( 'FB' ) ) . toBeInTheDocument ( ) ;
185
+ } ) ;
186
+
177
187
it ( 'displays platform list icons for project Avatar' , function ( ) {
178
188
const project = ProjectFixture ( {
179
189
platform : 'java' ,
Original file line number Diff line number Diff line change @@ -7,14 +7,18 @@ import SentryAppAvatar from 'sentry/components/avatar/sentryAppAvatar';
7
7
import TeamAvatar from 'sentry/components/avatar/teamAvatar' ;
8
8
import UserAvatar from 'sentry/components/avatar/userAvatar' ;
9
9
import type {
10
+ Actor ,
10
11
AvatarProject ,
11
12
AvatarSentryApp ,
12
13
DocIntegration ,
13
14
OrganizationSummary ,
14
15
Team ,
15
16
} from 'sentry/types' ;
16
17
18
+ import ActorAvatar from './actorAvatar' ;
19
+
17
20
type Props = {
21
+ actor ?: Actor ;
18
22
docIntegration ?: DocIntegration ;
19
23
/**
20
24
* True if the Avatar is full color, rather than B&W (Used for SentryAppAvatar)
@@ -33,6 +37,7 @@ type Props = {
33
37
const Avatar = forwardRef ( function Avatar (
34
38
{
35
39
hasTooltip = false ,
40
+ actor,
36
41
user,
37
42
team,
38
43
project,
@@ -47,6 +52,10 @@ const Avatar = forwardRef(function Avatar(
47
52
) {
48
53
const commonProps = { hasTooltip, forwardedRef : ref , ...props } ;
49
54
55
+ if ( actor ) {
56
+ return < ActorAvatar actor = { actor } { ...commonProps } /> ;
57
+ }
58
+
50
59
if ( user ) {
51
60
return < UserAvatar user = { user } { ...commonProps } /> ;
52
61
}
You can’t perform that action at this time.
0 commit comments