mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-17 19:57:56 +00:00
fix(ui): hide email if not present in the data (#15927)
This commit is contained in:
parent
6c44308ba4
commit
f4ebfbbfc6
@ -223,19 +223,25 @@ const UserProfileDetails = ({
|
||||
};
|
||||
|
||||
const userEmailRender = useMemo(
|
||||
() => (
|
||||
<Space align="center">
|
||||
<Typography.Text
|
||||
className="text-grey-muted"
|
||||
data-testid="user-email-label">{`${t(
|
||||
'label.email'
|
||||
)} :`}</Typography.Text>
|
||||
() =>
|
||||
userData.email && (
|
||||
<>
|
||||
<Space align="center">
|
||||
<Typography.Text
|
||||
className="text-grey-muted"
|
||||
data-testid="user-email-label">{`${t(
|
||||
'label.email'
|
||||
)} :`}</Typography.Text>
|
||||
|
||||
<Typography.Paragraph className="m-b-0" data-testid="user-email-value">
|
||||
{userData.email}
|
||||
</Typography.Paragraph>
|
||||
</Space>
|
||||
),
|
||||
<Typography.Paragraph
|
||||
className="m-b-0"
|
||||
data-testid="user-email-value">
|
||||
{userData.email}
|
||||
</Typography.Paragraph>
|
||||
</Space>
|
||||
<Divider type="vertical" />
|
||||
</>
|
||||
),
|
||||
[userData.email]
|
||||
);
|
||||
|
||||
|
@ -263,4 +263,20 @@ describe('Test User Profile Details Component', () => {
|
||||
'defaultPersona'
|
||||
);
|
||||
});
|
||||
|
||||
it('should not render if not present', async () => {
|
||||
render(
|
||||
<UserProfileDetails
|
||||
{...mockPropsData}
|
||||
userData={{ ...USER_DATA, email: '' }}
|
||||
/>,
|
||||
{
|
||||
wrapper: MemoryRouter,
|
||||
}
|
||||
);
|
||||
|
||||
// user email
|
||||
expect(screen.queryByTestId('user-email-label')).not.toBeInTheDocument();
|
||||
expect(screen.queryByTestId('user-email-value')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user