diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_overview/components/layout/kibana_header_actions.test.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_overview/components/layout/kibana_header_actions.test.tsx new file mode 100644 index 0000000000000..88f5da60e3627 --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_overview/components/layout/kibana_header_actions.test.tsx @@ -0,0 +1,34 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; + +import { mount } from 'enzyme'; + +import { EuiPopover, EuiButtonEmpty } from '@elastic/eui'; + +import { EnterpriseSearchOverviewHeaderActions } from './kibana_header_actions'; + +describe('Enterprise Search overview HeaderActions', () => { + it('renders', () => { + const wrapper = mount(); + const popover = wrapper.find(EuiPopover); + + expect(popover.find(EuiButtonEmpty).text()).toContain('Deployment details'); + expect(popover.prop('isOpen')).toBeFalsy(); + }); + + it('opens popover when clicked', () => { + const wrapper = mount(); + + expect(wrapper.find(EuiPopover).prop('isOpen')).toBeFalsy(); + wrapper.find(EuiPopover).find(EuiButtonEmpty).simulate('click'); + wrapper.update(); + + expect(wrapper.find(EuiPopover).prop('isOpen')).toBeTruthy(); + }); +}); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/add_content_empty_prompt/add_content_empty_prompt.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/add_content_empty_prompt/add_content_empty_prompt.test.tsx new file mode 100644 index 0000000000000..b9e23f00f06b5 --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/shared/add_content_empty_prompt/add_content_empty_prompt.test.tsx @@ -0,0 +1,29 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; + +import { shallow, ShallowWrapper } from 'enzyme'; + +import { EuiLinkTo } from '../react_router_helpers'; + +import { AddContentEmptyPrompt } from '.'; + +describe('AddContentEmptyPrompt', () => { + let wrapper: ShallowWrapper; + + beforeAll(() => { + wrapper = shallow(); + }); + + it('renders', () => { + expect(wrapper.find('h2').text()).toEqual('Add content to Enterprise Search'); + expect(wrapper.find(EuiLinkTo).prop('to')).toEqual( + '/app/enterprise_search/content/search_indices' + ); + }); +}); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/add_content_empty_prompt/add_content_empty_prompt.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/add_content_empty_prompt/add_content_empty_prompt.tsx index d64a31a6f1942..569013879c6ac 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/add_content_empty_prompt/add_content_empty_prompt.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/add_content_empty_prompt/add_content_empty_prompt.tsx @@ -69,6 +69,7 @@ export const AddContentEmptyPrompt: React.FC = () => { + {/* TODO need link for Learn More link*/} {i18n.translate('xpack.enterpriseSearch.overview.emptyState.footerLinkTitle', { defaultMessage: 'Learn more', diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/elasticsearch_resources/elasticsearch_resources.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/elasticsearch_resources/elasticsearch_resources.test.tsx new file mode 100644 index 0000000000000..3dd3b1c8ddfac --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/shared/elasticsearch_resources/elasticsearch_resources.test.tsx @@ -0,0 +1,47 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +jest.mock('../doc_links', () => ({ + docLinks: { + elasticsearchGettingStarted: 'elasticsearchGettingStarted-link', + elasticsearchCreateIndex: 'elasticsearchCreateIndex-link', + clientsGuide: 'elasticsearchClientsGuide-link', + }, +})); +import React from 'react'; + +import { shallow, ShallowWrapper } from 'enzyme'; + +import { EuiLink } from '@elastic/eui'; + +import { ElasticsearchResources } from '.'; + +describe('ElasticsearchResources', () => { + let wrapper: ShallowWrapper; + + beforeAll(() => { + wrapper = shallow(); + }); + + it('renders', () => { + expect(wrapper.find('h4').text()).toEqual('Resources'); + + expect(wrapper.find(EuiLink).at(0).prop('href')).toEqual('elasticsearchGettingStarted-link'); + expect(wrapper.find(EuiLink).at(0).text()).toEqual('Getting started with Elasticsearch'); + + expect(wrapper.find(EuiLink).at(1).prop('href')).toEqual('elasticsearchCreateIndex-link'); + expect(wrapper.find(EuiLink).at(1).text()).toEqual('Create a new index'); + + expect(wrapper.find(EuiLink).at(2).prop('href')).toEqual('elasticsearchClientsGuide-link'); + expect(wrapper.find(EuiLink).at(2).text()).toEqual('Setup a language client'); + + expect(wrapper.find(EuiLink).at(3).prop('href')).toEqual( + 'https://github.com/elastic/search-ui/tree/master/packages/search-ui-elasticsearch-connector' + ); + expect(wrapper.find(EuiLink).at(3).text()).toEqual('Search UI for Elasticsearch'); + }); +}); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/getting_started_steps/getting_started_steps.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/getting_started_steps/getting_started_steps.test.tsx new file mode 100644 index 0000000000000..0595e39475b4b --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/shared/getting_started_steps/getting_started_steps.test.tsx @@ -0,0 +1,56 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +jest.mock('../doc_links', () => ({ + docLinks: { + elasticsearchGettingStarted: 'elasticsearchGettingStarted-link', + elasticsearchCreateIndex: 'elasticsearchCreateIndex-link', + clientsGuide: 'elasticsearchClientsGuide-link', + }, +})); +import React from 'react'; + +import { shallow, ShallowWrapper } from 'enzyme'; + +import { EuiSteps } from '@elastic/eui'; + +import { EuiLinkTo } from '../react_router_helpers'; + +import { IconRow } from './icon_row'; + +import { GettingStartedSteps } from '.'; + +describe('GettingStartedSteps', () => { + let wrapper: ShallowWrapper; + + beforeAll(() => { + wrapper = shallow(); + }); + + it('renders', () => { + const steps = wrapper + .find(EuiSteps) + .prop('steps') + .map(({ title, children, status, ...rest }) => ({ + title, + status, + children: shallow(
{children}
), + ...rest, + })); + + expect(steps[0].title).toEqual('Add your documents and data to Enterprise Search'); + expect(steps[0].status).toEqual('current'); + expect(steps[0].children.find(IconRow).length).toEqual(1); + + expect(steps[1].title).toEqual('Build a search experience'); + expect(steps[1].status).toEqual('incomplete'); + expect(steps[1].children.find(EuiLinkTo).prop('to')).toEqual('/elasticsearch_guide'); + + expect(steps[2].title).toEqual('Tune your search relevance'); + expect(steps[2].status).toEqual('incomplete'); + }); +}); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/getting_started_steps/getting_started_steps.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/getting_started_steps/getting_started_steps.tsx index d574d17d31cef..e9a3f477c7049 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/getting_started_steps/getting_started_steps.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/getting_started_steps/getting_started_steps.tsx @@ -98,6 +98,7 @@ export const GettingStartedSteps: React.FC = () => { isOpen={isPopoverOpen} closePopover={() => setIsPopoverOpen(false)} > + {/* TODO add onclick for these links*/} {}}>