This commit is contained in:
mabashian 2019-11-08 14:18:44 -05:00
parent c294a63f32
commit 823a74c98b
7 changed files with 40 additions and 18 deletions

View File

@ -175,7 +175,8 @@ class HostsList extends Component {
const canAdd =
actions && Object.prototype.hasOwnProperty.call(actions, 'POST');
const isAllSelected = selected.length > 0 && selected.length === hosts.length;
const isAllSelected =
selected.length > 0 && selected.length === hosts.length;
return (
<Fragment>

View File

@ -174,7 +174,8 @@ class InventoriesList extends Component {
const { match, i18n } = this.props;
const canAdd =
actions && Object.prototype.hasOwnProperty.call(actions, 'POST');
const isAllSelected = selected.length > 0 && selected.length === inventories.length;
const isAllSelected =
selected.length > 0 && selected.length === inventories.length;
return (
<PageSection>
<Card>

View File

@ -141,7 +141,8 @@ class ProjectsList extends Component {
const canAdd =
actions && Object.prototype.hasOwnProperty.call(actions, 'POST');
const isAllSelected = selected.length > 0 && selected.length === projects.length;
const isAllSelected =
selected.length > 0 && selected.length === projects.length;
return (
<Fragment>

View File

@ -16,10 +16,10 @@ import TeamEdit from './TeamEdit';
import { TeamsAPI } from '@api';
const CardHeader = styled(PFCardHeader)`
--pf-c-card--first-child--PaddingTop: 0;
--pf-c-card--child--PaddingLeft: 0;
--pf-c-card--child--PaddingRight: 0;
position: relative;
--pf-c-card--first-child--PaddingTop: 0;
--pf-c-card--child--PaddingLeft: 0;
--pf-c-card--child--PaddingRight: 0;
position: relative;
`;
class Team extends Component {

View File

@ -139,7 +139,8 @@ class TeamsList extends Component {
const canAdd =
actions && Object.prototype.hasOwnProperty.call(actions, 'POST');
const isAllSelected = selected.length > 0 && selected.length === teams.length;
const isAllSelected =
selected.length > 0 && selected.length === teams.length;
return (
<Fragment>

View File

@ -77,14 +77,23 @@ describe('<TeamsList />', () => {
'TeamsList',
el => el.state('hasContentLoading') === false
);
expect(wrapper.find('input[type="checkbox"]').findWhere(n => n.prop('checked') === true).length).toBe(0);
expect(
wrapper
.find('input[type="checkbox"]')
.findWhere(n => n.prop('checked') === true).length
).toBe(0);
wrapper
.find('TeamListItem').at(0)
.find('TeamListItem')
.at(0)
.find('DataListCheck')
.props()
.onChange(true);
wrapper.update();
expect(wrapper.find('input[type="checkbox"]').findWhere(n => n.prop('checked') === true).length).toBe(1);
expect(
wrapper
.find('input[type="checkbox"]')
.findWhere(n => n.prop('checked') === true).length
).toBe(1);
});
test('Select all checkbox selects and unselects all rows', async () => {
@ -94,19 +103,31 @@ describe('<TeamsList />', () => {
'TeamsList',
el => el.state('hasContentLoading') === false
);
expect(wrapper.find('input[type="checkbox"]').findWhere(n => n.prop('checked') === true).length).toBe(0);
expect(
wrapper
.find('input[type="checkbox"]')
.findWhere(n => n.prop('checked') === true).length
).toBe(0);
wrapper
.find('Checkbox#select-all')
.props()
.onChange(true);
wrapper.update();
expect(wrapper.find('input[type="checkbox"]').findWhere(n => n.prop('checked') === true).length).toBe(4);
expect(
wrapper
.find('input[type="checkbox"]')
.findWhere(n => n.prop('checked') === true).length
).toBe(4);
wrapper
.find('Checkbox#select-all')
.props()
.onChange(false);
wrapper.update();
expect(wrapper.find('input[type="checkbox"]').findWhere(n => n.prop('checked') === true).length).toBe(0);
expect(
wrapper
.find('input[type="checkbox"]')
.findWhere(n => n.prop('checked') === true).length
).toBe(0);
});
test('api is called to delete Teams for each team in selected.', () => {

View File

@ -42,10 +42,7 @@ class TeamListItem extends React.Component {
dataListCells={[
<DataListCell key="divider">
<VerticalSeparator />
<Link
id={labelId}
to={`${detailUrl}`}
>
<Link id={labelId} to={`${detailUrl}`}>
<b>{team.name}</b>
</Link>
</DataListCell>,