mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 23:51:09 +03:00
Add close button to job detail and test
This commit is contained in:
parent
cda5cc25b8
commit
416d30a189
@ -10,7 +10,7 @@ describe('<Jobs />', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should display correct breadcrumb heading', () => {
|
test('should display a breadcrumb heading', () => {
|
||||||
const history = createMemoryHistory({
|
const history = createMemoryHistory({
|
||||||
initialEntries: ['/jobs'],
|
initialEntries: ['/jobs'],
|
||||||
});
|
});
|
||||||
@ -30,7 +30,7 @@ describe('<Jobs />', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
expect(wrapper.find('BreadcrumbHeading').text()).toEqual('Jobs');
|
expect(wrapper.find('BreadcrumbHeading').length).toBe(1);
|
||||||
wrapper.unmount();
|
wrapper.unmount();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -12,4 +12,13 @@ describe('<JobDetail />', () => {
|
|||||||
<JobDetail job={ mockDetails } />
|
<JobDetail job={ mockDetails } />
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should display a Close button', () => {
|
||||||
|
const wrapper = mountWithContexts(
|
||||||
|
<JobDetail job={ mockDetails } />
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(wrapper.find('Button[aria-label="close"]').length).toBe(1);
|
||||||
|
wrapper.unmount();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { CardBody } from '@patternfly/react-core';
|
import { Link, withRouter } from 'react-router-dom';
|
||||||
|
import { withI18n } from '@lingui/react';
|
||||||
|
import { t } from '@lingui/macro';
|
||||||
|
import { CardBody, Button } from '@patternfly/react-core';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const ActionButtonWrapper = styled.div`
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
`;
|
||||||
class JobDetail extends Component {
|
class JobDetail extends Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
super(props);
|
super(props);
|
||||||
@ -9,15 +16,28 @@ class JobDetail extends Component {
|
|||||||
|
|
||||||
render () {
|
render () {
|
||||||
const {
|
const {
|
||||||
job
|
job,
|
||||||
|
i18n
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CardBody>
|
<CardBody>
|
||||||
<b>{job.name}</b>
|
<b>{job.name}</b>
|
||||||
|
|
||||||
|
<ActionButtonWrapper>
|
||||||
|
<Button
|
||||||
|
variant='secondary'
|
||||||
|
aria-label="close"
|
||||||
|
component={Link}
|
||||||
|
to={`/jobs`}
|
||||||
|
>
|
||||||
|
{i18n._(t`Close`)}
|
||||||
|
</Button>
|
||||||
|
</ActionButtonWrapper>
|
||||||
</CardBody>
|
</CardBody>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default JobDetail;
|
export default withI18n()(withRouter(JobDetail));
|
||||||
|
Loading…
Reference in New Issue
Block a user