mirror of
https://github.com/ansible/awx.git
synced 2026-03-20 10:27:34 -02:30
Rename TemplateForm to JobTemplateForm
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { withRouter, Redirect } from 'react-router-dom';
|
import { withRouter, Redirect } from 'react-router-dom';
|
||||||
import { CardBody } from '@patternfly/react-core';
|
import { CardBody } from '@patternfly/react-core';
|
||||||
import TemplateForm from '../shared/TemplateForm';
|
import JobTemplateForm from '../shared/JobTemplateForm';
|
||||||
import { JobTemplatesAPI } from '@api';
|
import { JobTemplatesAPI } from '@api';
|
||||||
import { JobTemplate } from '@types';
|
import { JobTemplate } from '@types';
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ class JobTemplateEdit extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<CardBody>
|
<CardBody>
|
||||||
<TemplateForm
|
<JobTemplateForm
|
||||||
template={template}
|
template={template}
|
||||||
handleCancel={this.handleCancel}
|
handleCancel={this.handleCancel}
|
||||||
handleSubmit={this.handleSubmit}
|
handleSubmit={this.handleSubmit}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ describe('<JobTemplateEdit />', () => {
|
|||||||
job_type: 'check',
|
job_type: 'check',
|
||||||
};
|
};
|
||||||
|
|
||||||
wrapper.find('TemplateForm').prop('handleSubmit')(updatedTemplateData);
|
wrapper.find('JobTemplateForm').prop('handleSubmit')(updatedTemplateData);
|
||||||
expect(JobTemplatesAPI.update).toHaveBeenCalledWith(1, updatedTemplateData);
|
expect(JobTemplatesAPI.update).toHaveBeenCalledWith(1, updatedTemplateData);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const QuestionCircleIcon = styled(PFQuestionCircleIcon)`
|
|||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
class TemplateForm extends Component {
|
class JobTemplateForm extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
template: JobTemplate.isRequired,
|
template: JobTemplate.isRequired,
|
||||||
handleCancel: PropTypes.func.isRequired,
|
handleCancel: PropTypes.func.isRequired,
|
||||||
@@ -137,4 +137,4 @@ class TemplateForm extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withI18n()(withRouter(TemplateForm));
|
export default withI18n()(withRouter(JobTemplateForm));
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
import { sleep } from '@testUtils/testUtils';
|
import { sleep } from '@testUtils/testUtils';
|
||||||
import TemplateForm from './TemplateForm';
|
import JobTemplateForm from './JobTemplateForm';
|
||||||
|
|
||||||
jest.mock('@api');
|
jest.mock('@api');
|
||||||
|
|
||||||
describe('<TemplateForm />', () => {
|
describe('<JobTemplateForm />', () => {
|
||||||
const mockData = {
|
const mockData = {
|
||||||
id: 1,
|
id: 1,
|
||||||
name: 'Foo',
|
name: 'Foo',
|
||||||
@@ -23,7 +23,7 @@ describe('<TemplateForm />', () => {
|
|||||||
|
|
||||||
test('initially renders successfully', () => {
|
test('initially renders successfully', () => {
|
||||||
mountWithContexts(
|
mountWithContexts(
|
||||||
<TemplateForm
|
<JobTemplateForm
|
||||||
template={mockData}
|
template={mockData}
|
||||||
handleSubmit={jest.fn()}
|
handleSubmit={jest.fn()}
|
||||||
handleCancel={jest.fn()}
|
handleCancel={jest.fn()}
|
||||||
@@ -33,7 +33,7 @@ describe('<TemplateForm />', () => {
|
|||||||
|
|
||||||
test('should update form values on input changes', () => {
|
test('should update form values on input changes', () => {
|
||||||
const wrapper = mountWithContexts(
|
const wrapper = mountWithContexts(
|
||||||
<TemplateForm
|
<JobTemplateForm
|
||||||
template={mockData}
|
template={mockData}
|
||||||
handleSubmit={jest.fn()}
|
handleSubmit={jest.fn()}
|
||||||
handleCancel={jest.fn()}
|
handleCancel={jest.fn()}
|
||||||
@@ -70,7 +70,7 @@ describe('<TemplateForm />', () => {
|
|||||||
test('should call handleSubmit when Submit button is clicked', async () => {
|
test('should call handleSubmit when Submit button is clicked', async () => {
|
||||||
const handleSubmit = jest.fn();
|
const handleSubmit = jest.fn();
|
||||||
const wrapper = mountWithContexts(
|
const wrapper = mountWithContexts(
|
||||||
<TemplateForm
|
<JobTemplateForm
|
||||||
template={mockData}
|
template={mockData}
|
||||||
handleSubmit={handleSubmit}
|
handleSubmit={handleSubmit}
|
||||||
handleCancel={jest.fn()}
|
handleCancel={jest.fn()}
|
||||||
@@ -86,7 +86,7 @@ describe('<TemplateForm />', () => {
|
|||||||
test('should call handleCancel when Cancel button is clicked', () => {
|
test('should call handleCancel when Cancel button is clicked', () => {
|
||||||
const handleCancel = jest.fn();
|
const handleCancel = jest.fn();
|
||||||
const wrapper = mountWithContexts(
|
const wrapper = mountWithContexts(
|
||||||
<TemplateForm
|
<JobTemplateForm
|
||||||
template={mockData}
|
template={mockData}
|
||||||
handleSubmit={jest.fn()}
|
handleSubmit={jest.fn()}
|
||||||
handleCancel={handleCancel}
|
handleCancel={handleCancel}
|
||||||
@@ -1 +1 @@
|
|||||||
export { default } from './TemplateForm';
|
export { default } from './JobTemplateForm';
|
||||||
|
|||||||
Reference in New Issue
Block a user