Skip to content

Commit

Permalink
fix jest test
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkime committed Aug 12, 2020
1 parent 62b5f42 commit 1c39a74
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 22 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers';
describe('EmptyIndexPatternPrompt', () => {
it('should render normally', () => {
const component = shallowWithI18nProvider(
<EmptyIndexPatternPrompt canSave creationOptions={[{ text: 'default', onClick: () => {} }]} />
<EmptyIndexPatternPrompt
canSave
creationOptions={[{ text: 'default', onClick: () => {} }]}
docLinksIndexPatternIntro={'testUrl'}
setBreadcrumbs={() => {}}
/>
);

expect(component).toMatchSnapshot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,24 @@ import { EuiDescriptionListTitle } from '@elastic/eui';
import { EuiDescriptionListDescription, EuiDescriptionList } from '@elastic/eui';
import { EuiLink } from '@elastic/eui';
import { getListBreadcrumbs } from '../../breadcrumbs';
import { IndexPatternManagmentContext } from '../../../types';
import { useKibana } from '../../../../../../plugins/kibana_react/public';
import { IndexPatternCreationOption } from '../../types';
import { CreateButton } from '../../create_button';
import { Illustration } from './assets/index_pattern_illustration';
import { ManagementAppMountParams } from '../../../../../management/public';

interface Props {
canSave: boolean;
creationOptions: IndexPatternCreationOption[];
docLinksIndexPatternIntro: string;
setBreadcrumbs: ManagementAppMountParams['setBreadcrumbs'];
}

export const EmptyIndexPatternPrompt = ({ canSave, creationOptions }: Props) => {
const { setBreadcrumbs, docLinks } = useKibana<IndexPatternManagmentContext>().services;
export const EmptyIndexPatternPrompt = ({
canSave,
creationOptions,
docLinksIndexPatternIntro,
setBreadcrumbs,
}: Props) => {
setBreadcrumbs(getListBreadcrumbs());

return (
Expand Down Expand Up @@ -93,7 +98,7 @@ export const EmptyIndexPatternPrompt = ({ canSave, creationOptions }: Props) =>
/>
</EuiDescriptionListTitle>
<EuiDescriptionListDescription>
<EuiLink href={docLinks.links.indexPatterns.introduction} target="_blank" external>
<EuiLink href={docLinksIndexPatternIntro} target="_blank" external>
<FormattedMessage
id="indexPatternManagement.emptyIndexPatternPrompt.documentation"
defaultMessage="Read documentation"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,14 @@ export const IndexPatternTable = ({ canSave, history }: Props) => {
/>
);
} else {
return <EmptyIndexPatternPrompt canSave={canSave} creationOptions={creationOptions} />;
return (
<EmptyIndexPatternPrompt
canSave={canSave}
creationOptions={creationOptions}
docLinksIndexPatternIntro={docLinks.links.indexPatterns.introduction}
setBreadcrumbs={setBreadcrumbs}
/>
);
}
}

Expand Down

0 comments on commit 1c39a74

Please sign in to comment.