diff --git a/awx/ui_next/src/screens/Inventory/shared/InventoryHostForm.jsx b/awx/ui_next/src/screens/Inventory/shared/InventoryHostForm.jsx deleted file mode 100644 index f51e2abee9..0000000000 --- a/awx/ui_next/src/screens/Inventory/shared/InventoryHostForm.jsx +++ /dev/null @@ -1,74 +0,0 @@ -import React from 'react'; -import { func, shape } from 'prop-types'; -import { Formik } from 'formik'; -import { withI18n } from '@lingui/react'; -import { t } from '@lingui/macro'; -import { Form } from '@patternfly/react-core'; -import FormRow from '@components/FormRow'; -import FormField from '@components/FormField'; -import FormActionGroup from '@components/FormActionGroup/FormActionGroup'; -import { VariablesField } from '@components/CodeMirrorInput'; -import { required } from '@util/validators'; - -function InventoryHostForm({ handleSubmit, handleCancel, host, i18n }) { - return ( - - {formik => ( -
- - - - - - - - { - formik.handleSubmit(); - }} - /> - - )} -
- ); -} - -InventoryHostForm.propTypes = { - handleSubmit: func.isRequired, - handleCancel: func.isRequired, - host: shape({}), -}; - -InventoryHostForm.defaultProps = { - host: { - name: '', - description: '', - variables: '---\n', - }, -}; - -export default withI18n()(InventoryHostForm); diff --git a/awx/ui_next/src/screens/Inventory/shared/InventoryHostForm.test.jsx b/awx/ui_next/src/screens/Inventory/shared/InventoryHostForm.test.jsx deleted file mode 100644 index 72a1d3b08e..0000000000 --- a/awx/ui_next/src/screens/Inventory/shared/InventoryHostForm.test.jsx +++ /dev/null @@ -1,58 +0,0 @@ -import React from 'react'; -import { act } from 'react-dom/test-utils'; -import { mountWithContexts } from '@testUtils/enzymeHelpers'; -import { sleep } from '@testUtils/testUtils'; -import InventoryHostForm from './InventoryHostForm'; - -jest.mock('@api'); - -describe('', () => { - let wrapper; - - const handleSubmit = jest.fn(); - const handleCancel = jest.fn(); - - const mockHostData = { - name: 'foo', - description: 'bar', - inventory: 1, - variables: '---\nfoo: bar', - }; - - beforeEach(async () => { - await act(async () => { - wrapper = mountWithContexts( - - ); - }); - }); - - afterEach(() => { - wrapper.unmount(); - }); - - test('should display form fields', () => { - expect(wrapper.find('FormGroup[label="Name"]').length).toBe(1); - expect(wrapper.find('FormGroup[label="Description"]').length).toBe(1); - expect(wrapper.find('VariablesField').length).toBe(1); - }); - - test('should call handleSubmit when Submit button is clicked', async () => { - expect(handleSubmit).not.toHaveBeenCalled(); - await act(async () => { - wrapper.find('button[aria-label="Save"]').simulate('click'); - }); - expect(handleSubmit).toHaveBeenCalled(); - }); - - test('should call handleCancel when Cancel button is clicked', async () => { - expect(handleCancel).not.toHaveBeenCalled(); - wrapper.find('button[aria-label="Cancel"]').simulate('click'); - await sleep(1); - expect(handleCancel).toHaveBeenCalled(); - }); -});