});
};
const component = mount();
-
setTimeout(() => {
+ component.update();
const panelError = component.find(PanelError);
expect(panelError.length).toBe(1);
done();
diff --git a/src/core_plugins/kibana/public/dashboard/panel/panel_header/panel_header_container.test.js b/src/core_plugins/kibana/public/dashboard/panel/panel_header/panel_header_container.test.js
index 0ff43bcc65411..4b91d80dd9caa 100644
--- a/src/core_plugins/kibana/public/dashboard/panel/panel_header/panel_header_container.test.js
+++ b/src/core_plugins/kibana/public/dashboard/panel/panel_header/panel_header_container.test.js
@@ -16,7 +16,7 @@ import {
import { getEmbeddableFactoryMock } from '../../__tests__/get_embeddable_factories_mock';
import {
TestSubjects,
-} from 'ui_framework/src/test';
+} from 'ui_framework/test';
function getProps(props = {}) {
const defaultTestProps = {
diff --git a/src/core_plugins/kibana/public/dashboard/styles/index.less b/src/core_plugins/kibana/public/dashboard/styles/index.less
index f39dba8a9f18e..651d28f89eb27 100644
--- a/src/core_plugins/kibana/public/dashboard/styles/index.less
+++ b/src/core_plugins/kibana/public/dashboard/styles/index.less
@@ -404,9 +404,13 @@ dashboard-viewport-provider {
}
.dashboard-viewport {
+ height: 100%;
+ width: 100%;
background-color: @dashboard-bg;
}
.dashboard-viewport-with-margins {
+ height: 100%;
+ width: 100%;
background-color: @dashboard-bg-with-margins;
}
diff --git a/src/core_plugins/kibana/public/dashboard/top_nav/clone_modal.test.js b/src/core_plugins/kibana/public/dashboard/top_nav/clone_modal.test.js
index 80947ab8200c7..3638aa6eab185 100644
--- a/src/core_plugins/kibana/public/dashboard/top_nav/clone_modal.test.js
+++ b/src/core_plugins/kibana/public/dashboard/top_nav/clone_modal.test.js
@@ -1,6 +1,9 @@
import React from 'react';
import sinon from 'sinon';
import { mount, render } from 'enzyme';
+import {
+ findTestSubject,
+} from 'ui_framework/test';
import {
DashboardCloneModal,
@@ -32,14 +35,14 @@ test('renders DashboardCloneModal', () => {
test('onClone', () => {
createComponent();
- component.find('[data-test-subj="cloneConfirmButton"]').simulate('click');
+ findTestSubject(component, 'cloneConfirmButton', false).simulate('click');
sinon.assert.calledWith(onClone, 'dash title');
sinon.assert.notCalled(onClose);
});
test('onClose', () => {
createComponent();
- component.find('[data-test-subj="cloneCancelButton"]').simulate('click');
+ findTestSubject(component, 'cloneCancelButton', false).simulate('click');
sinon.assert.calledOnce(onClose);
sinon.assert.notCalled(onClone);
});
@@ -48,6 +51,6 @@ test('title', () => {
createComponent();
const event = { target: { value: 'a' } };
component.find('input').simulate('change', event);
- component.find('[data-test-subj="cloneConfirmButton"]').simulate('click');
+ findTestSubject(component, 'cloneConfirmButton', false).simulate('click');
sinon.assert.calledWith(onClone, 'a');
});
diff --git a/src/core_plugins/metrics/public/components/__tests__/add_delete_buttons.js b/src/core_plugins/metrics/public/components/add_delete_buttons.test.js
similarity index 94%
rename from src/core_plugins/metrics/public/components/__tests__/add_delete_buttons.js
rename to src/core_plugins/metrics/public/components/add_delete_buttons.test.js
index debda175b69c8..202dc891c67d6 100644
--- a/src/core_plugins/metrics/public/components/__tests__/add_delete_buttons.js
+++ b/src/core_plugins/metrics/public/components/add_delete_buttons.test.js
@@ -2,10 +2,9 @@ import React from 'react';
import { expect } from 'chai';
import { shallow } from 'enzyme';
import sinon from 'sinon';
-import AddDeleteButtons from '../add_delete_buttons';
-
-describe('', () => {
+import AddDeleteButtons from './add_delete_buttons';
+describe('AddDeleteButtons', () => {
it('calls onAdd={handleAdd}', () => {
const handleAdd = sinon.spy();
const wrapper = shallow(
@@ -61,5 +60,4 @@ describe('', () => {
);
expect(wrapper.find({ text: 'Clone' })).to.have.length(0);
});
-
});
diff --git a/src/core_plugins/metrics/public/components/aggs/math.js b/src/core_plugins/metrics/public/components/aggs/math.js
index c0003ed381f1a..ffa339da228d2 100644
--- a/src/core_plugins/metrics/public/components/aggs/math.js
+++ b/src/core_plugins/metrics/public/components/aggs/math.js
@@ -1,4 +1,5 @@
-import React, { Component, PropTypes } from 'react';
+import React, { Component } from 'react';
+import PropTypes from 'prop-types';
import _ from 'lodash';
import uuid from 'uuid';
import AggRow from './agg_row';
diff --git a/src/core_plugins/metrics/public/components/panel_config/table.js b/src/core_plugins/metrics/public/components/panel_config/table.js
index 85aa74862aaa3..ca20a15ff50de 100644
--- a/src/core_plugins/metrics/public/components/panel_config/table.js
+++ b/src/core_plugins/metrics/public/components/panel_config/table.js
@@ -1,4 +1,5 @@
-import React, { Component, PropTypes } from 'react';
+import React, { Component } from 'react';
+import PropTypes from 'prop-types';
import FieldSelect from '../aggs/field_select';
import SeriesEditor from '../series_editor';
import { IndexPattern } from '../index_pattern';
diff --git a/src/core_plugins/metrics/public/components/vis_types/table/config.js b/src/core_plugins/metrics/public/components/vis_types/table/config.js
index fc2511e246f4d..94b6c2fc20d8c 100644
--- a/src/core_plugins/metrics/public/components/vis_types/table/config.js
+++ b/src/core_plugins/metrics/public/components/vis_types/table/config.js
@@ -1,4 +1,5 @@
-import React, { Component, PropTypes } from 'react';
+import React, { Component } from 'react';
+import PropTypes from 'prop-types';
import uuid from 'uuid';
import DataFormatPicker from '../../data_format_picker';
import createSelectHandler from '../../lib/create_select_handler';
diff --git a/src/core_plugins/metrics/public/components/vis_types/table/series.js b/src/core_plugins/metrics/public/components/vis_types/table/series.js
index ad4df66232462..6eb8e3a1baa58 100644
--- a/src/core_plugins/metrics/public/components/vis_types/table/series.js
+++ b/src/core_plugins/metrics/public/components/vis_types/table/series.js
@@ -1,4 +1,5 @@
-import React, { PropTypes } from 'react';
+import React from 'react';
+import PropTypes from 'prop-types';
import AddDeleteButtons from '../../add_delete_buttons';
import SeriesConfig from './config';
import Sortable from 'react-anything-sortable';
diff --git a/src/core_plugins/metrics/public/components/vis_types/table/vis.js b/src/core_plugins/metrics/public/components/vis_types/table/vis.js
index 2a3056eabeaac..68527fff658a2 100644
--- a/src/core_plugins/metrics/public/components/vis_types/table/vis.js
+++ b/src/core_plugins/metrics/public/components/vis_types/table/vis.js
@@ -1,5 +1,6 @@
import _ from 'lodash';
-import React, { Component, PropTypes } from 'react';
+import React, { Component } from 'react';
+import PropTypes from 'prop-types';
import ticFormatter from '../../lib/tick_formatter';
import calculateLabel from '../../../../common/calculate_label';
import { isSortable } from './is_sortable';
diff --git a/src/core_plugins/metrics/public/components/__tests__/yes_no.js b/src/core_plugins/metrics/public/components/yes_no.test.js
similarity index 93%
rename from src/core_plugins/metrics/public/components/__tests__/yes_no.js
rename to src/core_plugins/metrics/public/components/yes_no.test.js
index c0f53337b916e..a2b05d725493c 100644
--- a/src/core_plugins/metrics/public/components/__tests__/yes_no.js
+++ b/src/core_plugins/metrics/public/components/yes_no.test.js
@@ -2,10 +2,9 @@ import React from 'react';
import { expect } from 'chai';
import { shallow } from 'enzyme';
import sinon from 'sinon';
-import YesNo from '../yes_no';
-
-describe('', () => {
+import YesNo from './yes_no';
+describe('YesNo', () => {
it('call onChange={handleChange} on yes', () => {
const handleChange = sinon.spy();
const wrapper = shallow(
@@ -29,5 +28,4 @@ describe('', () => {
test: 0
});
});
-
});
diff --git a/src/dev/jest/config.json b/src/dev/jest/config.json
index 5e5c9f52cb10a..a30fe06e0c4f8 100644
--- a/src/dev/jest/config.json
+++ b/src/dev/jest/config.json
@@ -16,14 +16,15 @@
"moduleNameMapper": {
"^ui_framework/components": "/ui_framework/components",
"^ui_framework/services": "/ui_framework/services",
- "^ui_framework/src/test": "/ui_framework/src/test",
+ "^ui_framework/test": "/ui_framework/test",
"^ui/(.*)": "/src/ui/public/$1",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/src/dev/jest/mocks/file_mock.js",
"\\.(css|less|scss)$": "/src/dev/jest/mocks/style_mock.js"
},
"setupFiles": [
"/src/dev/jest/setup/babel_polyfill.js",
- "/src/dev/jest/setup/request_animation_frame_polyfill.js"
+ "/src/dev/jest/setup/request_animation_frame_polyfill.js",
+ "/src/dev/jest/setup/enzyme.js"
],
"coverageDirectory": "/target/jest-coverage",
"coverageReporters": [
diff --git a/src/dev/jest/setup/enzyme.js b/src/dev/jest/setup/enzyme.js
new file mode 100644
index 0000000000000..82edfc9e5adea
--- /dev/null
+++ b/src/dev/jest/setup/enzyme.js
@@ -0,0 +1,4 @@
+import { configure } from 'enzyme';
+import Adapter from 'enzyme-adapter-react-16';
+
+configure({ adapter: new Adapter() });
diff --git a/src/dev/jest/setup/request_animation_frame_polyfill.js b/src/dev/jest/setup/request_animation_frame_polyfill.js
index 0c0dd13932df7..059b24602ead8 100644
--- a/src/dev/jest/setup/request_animation_frame_polyfill.js
+++ b/src/dev/jest/setup/request_animation_frame_polyfill.js
@@ -16,3 +16,7 @@ window.requestAnimationFrame = (() => {
}
};
})();
+
+window.cancelAnimationFrame = (id) => {
+ clearTimeout(id);
+};
diff --git a/ui_framework/src/components/code_editor/__snapshots__/code_editor.test.js.snap b/ui_framework/src/components/code_editor/__snapshots__/code_editor.test.js.snap
index 971c88b219d5f..1778b94580ad5 100644
--- a/ui_framework/src/components/code_editor/__snapshots__/code_editor.test.js.snap
+++ b/ui_framework/src/components/code_editor/__snapshots__/code_editor.test.js.snap
@@ -2,23 +2,21 @@
exports[`KuiCodeEditor behavior hint element should be disabled when the ui ace box gains focus 1`] = `
Press Enter to start
editing
.
When you’re done, press Escape to stop
editing
@@ -29,23 +27,46 @@ exports[`KuiCodeEditor behavior hint element should be disabled when the ui ace
exports[`KuiCodeEditor behavior hint element should be enabled when the ui ace box loses focus 1`] = `
Press Enter to start
editing
.
+ When you’re done, press Escape to stop
+ editing
+ .
+
+
+`;
+
+exports[`KuiCodeEditor behavior hint element should be tabable 1`] = `
+
+
+ Press Enter to start
+ editing
+ .
+
+
When you’re done, press Escape to stop
editing
@@ -68,28 +89,12 @@ exports[`KuiCodeEditor is rendered 1`] = `
-
- Press Enter to start
-
-
- editing
-
-
- .
-
+ Press Enter to start editing.
-
- When you’re done, press Escape to stop
-
-
- editing
-
-
- .
-
+ When you’re done, press Escape to stop editing.
-
- Press Enter to start
-
-
- interacting with the code
-
-
- .
-
+ Press Enter to start interacting with the code.
-
- When you’re done, press Escape to stop
-
-
- interacting with the code
-
-
- .
-
+ When you’re done, press Escape to stop interacting with the code.