-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fleet] Fix input vars non correctly rendered in package policy editor (
- Loading branch information
Showing
2 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
...eate_package_policy_page/components/steps/components/package_policy_input_config.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import { createFleetTestRendererMock } from '../../../../../../../../mock'; | ||
|
||
import { PackagePolicyInputConfig } from './package_policy_input_config'; | ||
|
||
describe('PackagePolicyInputConfig', () => { | ||
function render(value = 'generic', datastreams: any = []) { | ||
const renderer = createFleetTestRendererMock(); | ||
const mockOnChange = jest.fn(); | ||
|
||
const utils = renderer.render( | ||
<PackagePolicyInputConfig | ||
hasInputStreams={false} | ||
inputVarsValidationResults={{}} | ||
packagePolicyInput={{ | ||
enabled: true, | ||
type: 'input', | ||
streams: [], | ||
}} | ||
updatePackagePolicyInput={mockOnChange} | ||
packageInputVars={[ | ||
{ | ||
name: 'test', | ||
title: 'Test', | ||
type: 'text', | ||
show_user: true, | ||
}, | ||
]} | ||
/> | ||
); | ||
|
||
return { utils, mockOnChange }; | ||
} | ||
|
||
it('should support input vars with show_user:true without default value', () => { | ||
const { utils } = render(); | ||
|
||
const inputEl = utils.findByTestId('textInput-test'); | ||
expect(inputEl).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters