Skip to content

Commit

Permalink
fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eokoneyo committed Feb 8, 2024
1 parent fcca139 commit c5e355a
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const getAlertUtils = (
});
toastNotifications.addDanger({
title: errorTitle,
text: toMountPoint(<Markdown readOnly>{error.message}</Markdown>, {
text: toMountPoint(<Markdown markdownContent={error.message} readOnly />, {
theme: core.theme,
i18n: core.i18n,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,23 @@ test('ErrorEmbeddable renders an embeddable with markdown message', async () =>
await waitFor(() => getByTestId('errorMessageMarkdown')); // wait for lazy markdown component
expect(getByText(/some link/i)).toMatchInlineSnapshot(`
<a
class="euiLink emotion-euiLink-primary"
href="http://localhost:5601/takeMeThere"
rel="noopener noreferrer"
target="_blank"
>
some link
<span
class="emotion-EuiExternalLinkIcon"
data-euiicon-type="popout"
>
External link
</span>
<span
class="emotion-euiScreenReaderOnly"
>
(opens in a new tab or window)
</span>
</a>
`);
});
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ describe('markdown vis controller', () => {

expect(getByText('markdown')).toMatchInlineSnapshot(`
<a
class="euiLink emotion-euiLink-primary"
href="http://daringfireball.net/projects/markdown"
rel="noreferrer"
>
markdown
</a>
Expand All @@ -53,7 +55,8 @@ describe('markdown vis controller', () => {

expect(getByText(/testing/i)).toMatchInlineSnapshot(`
<p>
Testing &lt;a&gt;html&lt;/a&gt;
Testing
html
</p>
`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ const MarkdownVisComponent = ({

return (
<div className="mkdVis" style={{ fontSize: `${fontSize}pt` }}>
<Markdown data-test-subj="markdownBody" openLinksInNewTab={openLinksInNewTab} readOnly>
{markdown}
</Markdown>
<Markdown
data-test-subj="markdownBody"
openLinksInNewTab={openLinksInNewTab}
markdownContent={markdown ?? ''}
readOnly
/>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const embeddableError = await testSubjects.find('embeddableError');
const errorMessage = await embeddableError.findByTestSubject('errorMessageMarkdown');
expect(await errorMessage.getVisibleText()).to.equal(
'Expected AND, OR, end of input, whitespace but "n" found. this < is not : a valid > query ----------^'
'Expected AND, OR, end of input, whitespace but "n" found.\nthis < is not : a valid > query\n----------^'
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,7 @@ function AccordionButtonContent({

function InstructionsContent({ markdown }: { markdown: string }) {
return (
<Markdown
className="euiText"
openLinksInNewTab={true}
whiteListedRules={['backticks', 'emphasis', 'link', 'list']}
>
<Markdown className="euiText" readOnly>
{markdown}
</Markdown>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const embeddableError = await testSubjects.find('embeddableError');
const errorMessage = await embeddableError.findByTestSubject('errorMessageMarkdown');
expect(await errorMessage.getVisibleText()).to.equal(
'Expected AND, OR, end of input, whitespace but "n" found. this < is not : a valid > query ----------^'
'Expected AND, OR, end of input, whitespace but "n" found.\nthis < is not : a valid > query\n----------^'
);
});

Expand Down

0 comments on commit c5e355a

Please sign in to comment.