Skip to content

Commit

Permalink
Migrate all KUI test helpers dependents to EUI test helpers (#15684) (
Browse files Browse the repository at this point in the history
…#15686)

* Migrate all KUI test helpers dependents to EUI test helpers.
* Remove TestSubjects test helper from KUI.
* Remove test helpers from the KUI public interface.
  • Loading branch information
cjcenizal authored Dec 19, 2017
1 parent 86f26f7 commit ba3e6ed
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import sinon from 'sinon';
import { mount, shallow } from 'enzyme';
import { findTestSubject } from 'ui_framework/test';
import { findTestSubject } from '@elastic/eui/lib/test';
import {
ControlsTab,
} from './controls_tab';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import sinon from 'sinon';
import { mount, shallow } from 'enzyme';
import { findTestSubject } from 'ui_framework/test';
import { findTestSubject } from '@elastic/eui/lib/test';

import {
InputControlVis,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { getEmbeddableFactoryMock } from '../__tests__/get_embeddable_factories_

import {
takeMountedSnapshot,
} from 'ui_framework/test';
} from '@elastic/eui/lib/test';

function getProps(props = {}) {
const defaultTestProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ import {
embeddableRenderFinished,
} from '../../actions';
import { getEmbeddableFactoryMock } from '../../__tests__/get_embeddable_factories_mock';
import {
TestSubjects,
} from 'ui_framework/test';
import { findTestSubject } from '@elastic/eui/lib/test';

function getProps(props = {}) {
const defaultTestProps = {
Expand All @@ -40,20 +38,20 @@ afterAll(() => {

test('Panel header shows embeddable title when nothing is set on the panel', () => {
component = mount(<Provider store={store}><PanelHeaderContainer {...getProps()} /></Provider>);
expect(TestSubjects.getText(component, 'dashboardPanelTitle')).toBe('my embeddable title');
expect(findTestSubject(component, 'dashboardPanelTitle').text()).toBe('my embeddable title');
});

test('Panel header shows panel title when it is set on the panel', () => {
store.dispatch(setPanelTitle('my custom panel title', 'foo1'));
expect(TestSubjects.getText(component, 'dashboardPanelTitle')).toBe('my custom panel title');
expect(findTestSubject(component, 'dashboardPanelTitle').text()).toBe('my custom panel title');
});

test('Panel header shows no panel title when it is set to an empty string on the panel', () => {
store.dispatch(setPanelTitle('', 'foo1'));
expect(TestSubjects.getText(component, 'dashboardPanelTitle')).toBe('');
expect(findTestSubject(component, 'dashboardPanelTitle').text()).toBe('');
});

test('Panel header shows embeddable title when the panel title is reset', () => {
store.dispatch(resetPanelTitle('foo1'));
expect(TestSubjects.getText(component, 'dashboardPanelTitle')).toBe('my embeddable title');
expect(findTestSubject(component, 'dashboardPanelTitle').text()).toBe('my embeddable title');
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import sinon from 'sinon';
import { mount, render } from 'enzyme';
import {
findTestSubject,
} from 'ui_framework/test';
} from '@elastic/eui/lib/test';

import {
DashboardCloneModal,
Expand Down
3 changes: 0 additions & 3 deletions ui_framework/src/test/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
export { requiredProps } from './required_props';
export { takeMountedSnapshot } from './take_mounted_snapshot';
export { findTestSubject } from './find_test_subject';
import * as TestSubjects from './test_subjects';
export { TestSubjects };

8 changes: 0 additions & 8 deletions ui_framework/src/test/test_subjects.js

This file was deleted.

1 change: 0 additions & 1 deletion ui_framework/test/index.js

This file was deleted.

0 comments on commit ba3e6ed

Please sign in to comment.