mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 11:00:03 -03: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:
commit
13f2b3f632
@ -52,7 +52,8 @@ function BecomeMethodField({ fieldOptions, isRequired }) {
|
||||
helpers.setValue(option);
|
||||
setIsOpen(false);
|
||||
}}
|
||||
isExpanded={isOpen}
|
||||
isOpen={isOpen}
|
||||
id="privilege-escalation-methods"
|
||||
selections={becomeMethodField.value}
|
||||
isCreatable
|
||||
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);
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user