[input controls] use KuiCheckBoxLabel to ensure proper spacing between checkbox and label (#15301) (#15330)

* use KuiCheckBoxLabel to ensure proper spacing between checkbox and label

* upper case Kibana

* fix broken jest test
This commit is contained in:
Nathan Reese 2017-11-30 16:43:33 -07:00 committed by GitHub
parent 1f99c049bc
commit de8988397c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 22 deletions

View file

@ -14,16 +14,13 @@ exports[`renders OptionsTab 1`] = `
<KuiFieldGroupSection
isWide={false}
>
<label>
<input
checked={false}
className="kuiCheckBox"
data-test-subj="inputControlEditorUpdateFiltersOnChangeCheckbox"
onChange={[Function]}
type="checkbox"
/>
Update kibana filters on each change
</label>
<KuiCheckBoxLabel
data-test-subj="inputControlEditorUpdateFiltersOnChangeCheckbox"
isChecked={false}
isDisabled={false}
onChange={[Function]}
text="Update Kibana filters on each change"
/>
</KuiFieldGroupSection>
</KuiFieldGroup>
</div>

View file

@ -1,7 +1,10 @@
import _ from 'lodash';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { KuiFieldGroup, KuiFieldGroupSection } from 'ui_framework/components';
import {
KuiFieldGroup,
KuiFieldGroupSection,
KuiCheckBoxLabel } from 'ui_framework/components';
export class OptionsTab extends Component {
constructor(props) {
@ -28,16 +31,12 @@ export class OptionsTab extends Component {
<div className="vis-editor-agg-header">
<KuiFieldGroup>
<KuiFieldGroupSection>
<label>
<input
className="kuiCheckBox"
type="checkbox"
checked={this.props.scope.vis.params.updateFiltersOnChange}
onChange={this.handleUpdateFiltersChange}
data-test-subj="inputControlEditorUpdateFiltersOnChangeCheckbox"
/>
Update kibana filters on each change
</label>
<KuiCheckBoxLabel
text="Update Kibana filters on each change"
isChecked={this.props.scope.vis.params.updateFiltersOnChange}
onChange={this.handleUpdateFiltersChange}
data-test-subj="inputControlEditorUpdateFiltersOnChangeCheckbox"
/>
</KuiFieldGroupSection>
</KuiFieldGroup>
</div>

View file

@ -32,7 +32,7 @@ test('updateFiltersOnChange', () => {
scope={scopeMock}
stageEditorParams={stageEditorParams}
/>);
const checkbox = component.find('[data-test-subj="inputControlEditorUpdateFiltersOnChangeCheckbox"]');
const checkbox = component.find('[data-test-subj="inputControlEditorUpdateFiltersOnChangeCheckbox"] input[type="checkbox"]');
checkbox.simulate('change', { target: { checked: true } });
const expectedParams = {
updateFiltersOnChange: true