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 = const canAdd =
actions && Object.prototype.hasOwnProperty.call(actions, 'POST'); 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 ( return (
<Fragment> <Fragment>

View File

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

View File

@@ -141,7 +141,8 @@ class ProjectsList extends Component {
const canAdd = const canAdd =
actions && Object.prototype.hasOwnProperty.call(actions, 'POST'); 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 ( return (
<Fragment> <Fragment>

View File

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

View File

@@ -139,7 +139,8 @@ class TeamsList extends Component {
const canAdd = const canAdd =
actions && Object.prototype.hasOwnProperty.call(actions, 'POST'); 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 ( return (
<Fragment> <Fragment>

View File

@@ -77,14 +77,23 @@ describe('<TeamsList />', () => {
'TeamsList', 'TeamsList',
el => el.state('hasContentLoading') === false 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 wrapper
.find('TeamListItem').at(0) .find('TeamListItem')
.at(0)
.find('DataListCheck') .find('DataListCheck')
.props() .props()
.onChange(true); .onChange(true);
wrapper.update(); 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 () => { test('Select all checkbox selects and unselects all rows', async () => {
@@ -94,19 +103,31 @@ describe('<TeamsList />', () => {
'TeamsList', 'TeamsList',
el => el.state('hasContentLoading') === false 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 wrapper
.find('Checkbox#select-all') .find('Checkbox#select-all')
.props() .props()
.onChange(true); .onChange(true);
wrapper.update(); 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 wrapper
.find('Checkbox#select-all') .find('Checkbox#select-all')
.props() .props()
.onChange(false); .onChange(false);
wrapper.update(); 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.', () => { test('api is called to delete Teams for each team in selected.', () => {

View File

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