forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[embeddable] fix PresentationPanelError component throws when error.m…
…essage is empty string (elastic#186098) Closes elastic#186080 PR resolves issue by updating `Markdown` component to not throw when `readOnly` and `content` is empty. Components should only throw on catastrophic errors. In this case, Markdown can safely render an empty markdown. This is a better out come then crashing an application. ### Test instructions Follow steps from elastic#186095 and verify dashboard does not crash --------- Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
4093f4c
commit bd16e7e
Showing
3 changed files
with
30 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/plugins/presentation_panel/public/panel_component/presentation_panel_error.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { render, screen, waitFor } from '@testing-library/react'; | ||
import { PresentationPanelError } from './presentation_panel_error'; | ||
|
||
describe('PresentationPanelError', () => { | ||
test('should display error', async () => { | ||
render(<PresentationPanelError error={new Error('Simulated error')} />); | ||
await waitFor(() => screen.getByTestId('errorMessageMarkdown')); | ||
}); | ||
|
||
test('should display error with empty message', async () => { | ||
render(<PresentationPanelError error={new Error('')} />); | ||
await waitFor(() => screen.getByTestId('errorMessageMarkdown')); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters