mirror of
https://github.com/ansible/awx.git
synced 2026-03-10 22:19:28 -02:30
Merge pull request #8531 from AlexSCorey/8196-PrivilegeEscalation
Fixes broken select Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
@@ -52,7 +52,8 @@ function BecomeMethodField({ fieldOptions, isRequired }) {
|
|||||||
helpers.setValue(option);
|
helpers.setValue(option);
|
||||||
setIsOpen(false);
|
setIsOpen(false);
|
||||||
}}
|
}}
|
||||||
isExpanded={isOpen}
|
isOpen={isOpen}
|
||||||
|
id="privilege-escalation-methods"
|
||||||
selections={becomeMethodField.value}
|
selections={becomeMethodField.value}
|
||||||
isCreatable
|
isCreatable
|
||||||
onCreateOption={option => {
|
onCreateOption={option => {
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { act } from 'react-dom/test-utils';
|
||||||
|
import { Formik } from 'formik';
|
||||||
|
import { mountWithContexts } from '../../../../../testUtils/enzymeHelpers';
|
||||||
|
import BecomeMethodField from './BecomeMethodField';
|
||||||
|
|
||||||
|
const fieldOptions = {
|
||||||
|
help_text:
|
||||||
|
"Specify a method for 'become' operations. This is equivalent to specifying the --become-method Ansible parameter.",
|
||||||
|
id: 'become_method',
|
||||||
|
label: 'Privilege Escalation Method',
|
||||||
|
type: 'string',
|
||||||
|
};
|
||||||
|
describe('<BecomeMethodField>', () => {
|
||||||
|
let wrapper;
|
||||||
|
|
||||||
|
test('should mount properly', async () => {
|
||||||
|
await act(async () => {
|
||||||
|
wrapper = mountWithContexts(
|
||||||
|
<Formik>
|
||||||
|
<BecomeMethodField fieldOptions={fieldOptions} isRequired />
|
||||||
|
</Formik>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
expect(wrapper.find('BecomeMethodField').length).toBe(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should open privilege escalation properly', async () => {
|
||||||
|
await act(async () => {
|
||||||
|
wrapper = mountWithContexts(
|
||||||
|
<Formik>
|
||||||
|
<BecomeMethodField fieldOptions={fieldOptions} isRequired />
|
||||||
|
</Formik>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
act(() => wrapper.find('Select').prop('onToggle')(true));
|
||||||
|
wrapper.update();
|
||||||
|
expect(wrapper.find('SelectOption').length).toBe(12);
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user