From 95d5eac5bb2c16316c1c1b8c17d54b05507be725 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Tue, 19 Dec 2017 16:07:50 -0700 Subject: [PATCH 01/12] update jest tests as best as possible - found some bugs that need to be addressed --- .../__snapshots__/controls_tab.test.js.snap | 94 +++++++++++------- .../list_control_editor.test.js.snap | 67 +++++-------- .../__snapshots__/options_tab.test.js.snap | 98 +++++++------------ .../components/editor/control_editor.js | 97 +++++++++--------- .../public/components/editor/controls_tab.js | 65 +++++++----- .../public/components/editor/field_select.js | 36 +++---- .../components/editor/index_pattern_select.js | 36 +++---- .../components/editor/list_control_editor.js | 56 +++++------ .../editor/list_control_editor.test.js | 5 +- .../public/components/editor/options_tab.js | 82 +++++++--------- .../components/editor/range_control_editor.js | 53 +++++----- src/ui/public/styles/react-select.less | 12 ++- 12 files changed, 346 insertions(+), 355 deletions(-) diff --git a/src/core_plugins/input_control_vis/public/components/editor/__snapshots__/controls_tab.test.js.snap b/src/core_plugins/input_control_vis/public/components/editor/__snapshots__/controls_tab.test.js.snap index 99296d67edf26..9b28b5368cbf9 100644 --- a/src/core_plugins/input_control_vis/public/components/editor/__snapshots__/controls_tab.test.js.snap +++ b/src/core_plugins/input_control_vis/public/components/editor/__snapshots__/controls_tab.test.js.snap @@ -55,43 +55,71 @@ exports[`renders ControlsTab 1`] = ` key="2" moveControl={[Function]} /> -
-
- -
- - } - onClick={[Function]} - type="button" - > - Add - -
+ + Add + + + + + `; diff --git a/src/core_plugins/input_control_vis/public/components/editor/__snapshots__/list_control_editor.test.js.snap b/src/core_plugins/input_control_vis/public/components/editor/__snapshots__/list_control_editor.test.js.snap index 803263077bf4f..c79cd3a5885ab 100644 --- a/src/core_plugins/input_control_vis/public/components/editor/__snapshots__/list_control_editor.test.js.snap +++ b/src/core_plugins/input_control_vis/public/components/editor/__snapshots__/list_control_editor.test.js.snap @@ -14,48 +14,33 @@ exports[`renders ListControlEditor 1`] = ` onChange={[Function]} value="keywordField" /> -
- -
- -
-
-
+ + - -
- -
-
+ + `; diff --git a/src/core_plugins/input_control_vis/public/components/editor/__snapshots__/options_tab.test.js.snap b/src/core_plugins/input_control_vis/public/components/editor/__snapshots__/options_tab.test.js.snap index 1c2f00c085511..d441f57b6daf1 100644 --- a/src/core_plugins/input_control_vis/public/components/editor/__snapshots__/options_tab.test.js.snap +++ b/src/core_plugins/input_control_vis/public/components/editor/__snapshots__/options_tab.test.js.snap @@ -1,67 +1,41 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`renders OptionsTab 1`] = ` -
-
+ -
- - - - - -
-
- - - - - -
-
- - - - - -
-
-
+ + + + + + + + + `; diff --git a/src/core_plugins/input_control_vis/public/components/editor/control_editor.js b/src/core_plugins/input_control_vis/public/components/editor/control_editor.js index 5f373c12defe0..c1f6e51b1a883 100644 --- a/src/core_plugins/input_control_vis/public/components/editor/control_editor.js +++ b/src/core_plugins/input_control_vis/public/components/editor/control_editor.js @@ -1,10 +1,18 @@ -import classNames from 'classnames'; import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { RangeControlEditor } from './range_control_editor'; import { ListControlEditor } from './list_control_editor'; import { getTitle } from '../../editor_utils'; +import { + EuiButtonIcon, + EuiFieldText, + EuiForm, + EuiFormRow, + EuiPanel, + EuiText, +} from '@elastic/eui'; + export class ControlEditor extends Component { state = { @@ -77,80 +85,65 @@ export class ControlEditor extends Component { const labelId = `controlLabel${this.props.controlIndex}`; return ( -
-
- -
- -
-
+ + + + {controlEditor} -
+ ); } render() { - const visibilityToggleClasses = classNames('fa', { - 'fa-caret-right': !this.state.isEditorCollapsed, - 'fa-caret-down': this.state.isEditorCollapsed - }); + const visibilityToggleIcon = this.state.isEditorCollapsed ? 'arrowDown' : 'arrowRight'; return ( -
-
-