Rename TemplateForm to JobTemplateForm

This commit is contained in:
Marliana Lara 2019-06-27 11:46:52 -04:00
parent d4f50896de
commit b06421b870
No known key found for this signature in database
GPG Key ID: 38C73B40DFA809EE
5 changed files with 12 additions and 12 deletions

View File

@ -1,7 +1,7 @@
import React, { Component } from 'react';
import { withRouter, Redirect } from 'react-router-dom';
import { CardBody } from '@patternfly/react-core';
import TemplateForm from '../shared/TemplateForm';
import JobTemplateForm from '../shared/JobTemplateForm';
import { JobTemplatesAPI } from '@api';
import { JobTemplate } from '@types';
@ -57,7 +57,7 @@ class JobTemplateEdit extends Component {
return (
<CardBody>
<TemplateForm
<JobTemplateForm
template={template}
handleCancel={this.handleCancel}
handleSubmit={this.handleSubmit}

View File

@ -34,7 +34,7 @@ describe('<JobTemplateEdit />', () => {
job_type: 'check',
};
wrapper.find('TemplateForm').prop('handleSubmit')(updatedTemplateData);
wrapper.find('JobTemplateForm').prop('handleSubmit')(updatedTemplateData);
expect(JobTemplatesAPI.update).toHaveBeenCalledWith(1, updatedTemplateData);
});

View File

@ -18,7 +18,7 @@ const QuestionCircleIcon = styled(PFQuestionCircleIcon)`
margin-left: 10px;
`;
class TemplateForm extends Component {
class JobTemplateForm extends Component {
static propTypes = {
template: JobTemplate.isRequired,
handleCancel: PropTypes.func.isRequired,
@ -137,4 +137,4 @@ class TemplateForm extends Component {
}
}
export default withI18n()(withRouter(TemplateForm));
export default withI18n()(withRouter(JobTemplateForm));

View File

@ -1,11 +1,11 @@
import React from 'react';
import { mountWithContexts } from '@testUtils/enzymeHelpers';
import { sleep } from '@testUtils/testUtils';
import TemplateForm from './TemplateForm';
import JobTemplateForm from './JobTemplateForm';
jest.mock('@api');
describe('<TemplateForm />', () => {
describe('<JobTemplateForm />', () => {
const mockData = {
id: 1,
name: 'Foo',
@ -23,7 +23,7 @@ describe('<TemplateForm />', () => {
test('initially renders successfully', () => {
mountWithContexts(
<TemplateForm
<JobTemplateForm
template={mockData}
handleSubmit={jest.fn()}
handleCancel={jest.fn()}
@ -33,7 +33,7 @@ describe('<TemplateForm />', () => {
test('should update form values on input changes', () => {
const wrapper = mountWithContexts(
<TemplateForm
<JobTemplateForm
template={mockData}
handleSubmit={jest.fn()}
handleCancel={jest.fn()}
@ -70,7 +70,7 @@ describe('<TemplateForm />', () => {
test('should call handleSubmit when Submit button is clicked', async () => {
const handleSubmit = jest.fn();
const wrapper = mountWithContexts(
<TemplateForm
<JobTemplateForm
template={mockData}
handleSubmit={handleSubmit}
handleCancel={jest.fn()}
@ -86,7 +86,7 @@ describe('<TemplateForm />', () => {
test('should call handleCancel when Cancel button is clicked', () => {
const handleCancel = jest.fn();
const wrapper = mountWithContexts(
<TemplateForm
<JobTemplateForm
template={mockData}
handleSubmit={jest.fn()}
handleCancel={handleCancel}

View File

@ -1 +1 @@
export { default } from './TemplateForm';
export { default } from './JobTemplateForm';