mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Mappings editor] Re-enable scaled float test (#162834)
This commit is contained in:
parent
a14f76d96c
commit
58b4104691
3 changed files with 27 additions and 32 deletions
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { act } from 'react-dom/test-utils';
|
||||
|
||||
import { componentHelpers, MappingsEditorTestBed, kibanaVersion } from '../helpers';
|
||||
import { componentHelpers, MappingsEditorTestBed } from '../helpers';
|
||||
|
||||
const { setup, getMappingsEditorDataFactory } = componentHelpers.mappingsEditor;
|
||||
|
||||
|
@ -21,8 +21,7 @@ export const defaultScaledFloatParameters = {
|
|||
store: false,
|
||||
};
|
||||
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/145102
|
||||
describe.skip('Mappings editor: scaled float datatype', () => {
|
||||
describe('Mappings editor: scaled float datatype', () => {
|
||||
/**
|
||||
* Variable to store the mappings data forwarded to the consumer component
|
||||
*/
|
||||
|
@ -32,7 +31,7 @@ describe.skip('Mappings editor: scaled float datatype', () => {
|
|||
let testBed: MappingsEditorTestBed;
|
||||
|
||||
beforeAll(() => {
|
||||
jest.useFakeTimers({ legacyFakeTimers: true });
|
||||
jest.useFakeTimers();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
|
@ -90,15 +89,12 @@ describe.skip('Mappings editor: scaled float datatype', () => {
|
|||
await act(async () => {
|
||||
form.setInputValue('scalingFactor.input', '123');
|
||||
});
|
||||
await updateFieldAndCloseFlyout();
|
||||
expect(exists('mappingsEditorFieldEdit')).toBe(false);
|
||||
|
||||
if (kibanaVersion.major < 7) {
|
||||
expect(exists('boostParameterToggle')).toBe(true);
|
||||
} else {
|
||||
// Since 8.x the boost parameter is deprecated
|
||||
expect(exists('boostParameterToggle')).toBe(false);
|
||||
}
|
||||
component.update();
|
||||
|
||||
await updateFieldAndCloseFlyout();
|
||||
|
||||
expect(exists('mappingsEditorFieldEdit')).toBe(false);
|
||||
|
||||
// It should have the default parameters values added, plus the scaling factor
|
||||
updatedMappings.properties.myField = {
|
||||
|
|
|
@ -9,9 +9,9 @@ import React from 'react';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import SemVer from 'semver/classes/semver';
|
||||
|
||||
import { NormalizedField, Field as FieldType, ComboBoxOption } from '../../../../types';
|
||||
import { NormalizedField, Field as FieldType } from '../../../../types';
|
||||
import { getFieldConfig } from '../../../../lib';
|
||||
import { UseField, FormDataProvider, NumericField, Field } from '../../../../shared_imports';
|
||||
import { UseField, useFormData, NumericField, Field } from '../../../../shared_imports';
|
||||
import {
|
||||
StoreParameter,
|
||||
IndexParameter,
|
||||
|
@ -48,28 +48,26 @@ interface Props {
|
|||
}
|
||||
|
||||
export const NumericType = ({ field, kibanaVersion }: Props) => {
|
||||
const [formData] = useFormData({ watch: 'subType' });
|
||||
|
||||
return (
|
||||
<>
|
||||
<BasicParametersSection>
|
||||
{/* scaling_factor */}
|
||||
<FormDataProvider<{ subType?: ComboBoxOption[] }> pathsToWatch="subType">
|
||||
{(formData) => {
|
||||
return formData.subType?.[0]?.value === 'scaled_float' ? (
|
||||
<EditFieldFormRow
|
||||
title={PARAMETERS_DEFINITION.scaling_factor.title!}
|
||||
description={PARAMETERS_DEFINITION.scaling_factor.description}
|
||||
withToggle={false}
|
||||
>
|
||||
<UseField
|
||||
path="scaling_factor"
|
||||
config={getFieldConfig('scaling_factor')}
|
||||
component={Field}
|
||||
data-test-subj="scalingFactor"
|
||||
/>
|
||||
</EditFieldFormRow>
|
||||
) : null;
|
||||
}}
|
||||
</FormDataProvider>
|
||||
{formData.subType?.[0]?.value === 'scaled_float' ? (
|
||||
<EditFieldFormRow
|
||||
title={PARAMETERS_DEFINITION.scaling_factor.title!}
|
||||
description={PARAMETERS_DEFINITION.scaling_factor.description}
|
||||
withToggle={false}
|
||||
>
|
||||
<UseField
|
||||
path="scaling_factor"
|
||||
config={getFieldConfig('scaling_factor')}
|
||||
component={Field}
|
||||
data-test-subj="scalingFactor"
|
||||
/>
|
||||
</EditFieldFormRow>
|
||||
) : null}
|
||||
|
||||
<IndexParameter hasIndexOptions={false} />
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ export {
|
|||
useForm,
|
||||
useFormContext,
|
||||
UseMultiFields,
|
||||
useFormData,
|
||||
VALIDATION_TYPES,
|
||||
} from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue