alert titles can render jsx

Signed-off-by: Ryan Vazquez <ryanv@spotify.com>
This commit is contained in:
Ryan Vazquez
2021-05-07 14:39:20 -04:00
parent 6fa86f44f4
commit da80fd9667
3 changed files with 6 additions and 6 deletions
@@ -41,8 +41,8 @@ describe('<AlertInsightsSection/>', () => {
onAccept={jest.fn()}
/>,
);
expect(getByText(mockAlert.title)).toBeInTheDocument();
expect(getByText(mockAlert.subtitle)).toBeInTheDocument();
expect(getByText(mockAlert.title as string)).toBeInTheDocument();
expect(getByText(mockAlert.subtitle as string)).toBeInTheDocument();
expect(getByText('View Instructions')).toBeInTheDocument();
expect(queryByText('Snooze')).not.toBeInTheDocument();
expect(queryByText('Accept')).not.toBeInTheDocument();
@@ -50,8 +50,8 @@ describe('<AlertStatusSummary />', () => {
</MockScrollProvider>,
);
[mockSnoozed, mockAccepted, mockDismissed].forEach(a => {
expect(getByText(a.title)).toBeInTheDocument();
expect(getByText(a.subtitle)).toBeInTheDocument();
expect(getByText(a.title as string)).toBeInTheDocument();
expect(getByText(a.subtitle as string)).toBeInTheDocument();
expect(getByRole('img', { name: a.status })).toBeInTheDocument();
});
});
+2 -2
View File
@@ -34,8 +34,8 @@ import { Maybe } from './Maybe';
*/
export type Alert = {
title: string;
subtitle: string;
title: string | JSX.Element;
subtitle: string | JSX.Element;
element?: JSX.Element;
status?: AlertStatus;
url?: string;