Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
DatasourceMock,
} from '../mocks';
import { ExpressionRenderer } from 'src/legacy/core_plugins/data/public';
import { EuiPanel, EuiToolTip } from '@elastic/eui';

// calling this function will wait for all pending Promises from mock
// datasources to be processed by its callers.
Expand Down Expand Up @@ -1119,13 +1120,12 @@ describe('editor_frame', () => {

// TODO why is this necessary?
instance.update();
const suggestions = instance.find('[data-test-subj="suggestion-title"]');
expect(suggestions.map(el => el.text())).toEqual([
'Suggestion1',
'Suggestion2',
'Suggestion3',
'Suggestion4',
]);
expect(
instance
.find('[data-test-subj="lnsSuggestion"]')
.find(EuiPanel)
.map(el => el.parents(EuiToolTip).prop('content'))
).toEqual(['Suggestion1', 'Suggestion2', 'Suggestion3', 'Suggestion4']);
});

it('should switch to suggested visualization', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { ExpressionRenderer } from 'src/legacy/core_plugins/data/public';
import { SuggestionPanel, SuggestionPanelProps } from './suggestion_panel';
import { getSuggestions, Suggestion } from './suggestion_helpers';
import { fromExpression } from '@kbn/interpreter/target/common';
import { EuiIcon } from '@elastic/eui';
import { EuiIcon, EuiPanel, EuiToolTip } from '@elastic/eui';

jest.mock('./suggestion_helpers');

Expand Down Expand Up @@ -82,10 +82,12 @@ describe('suggestion_panel', () => {
it('should list passed in suggestions', () => {
const wrapper = mount(<SuggestionPanel {...defaultProps} />);

expect(wrapper.find('[data-test-subj="suggestion-title"]').map(el => el.text())).toEqual([
'Suggestion1',
'Suggestion2',
]);
expect(
wrapper
.find('[data-test-subj="lnsSuggestion"]')
.find(EuiPanel)
.map(el => el.parents(EuiToolTip).prop('content'))
).toEqual(['Suggestion1', 'Suggestion2']);
});

it('should dispatch visualization switch action if suggestion is clicked', () => {
Expand Down