<td className="thin nowrap text-middle">
<Button
className="js-bulk-apply-permission-template"
- disabled={this.props.total === 0}
+ disabled={this.props.selection.length === 0}
onClick={this.handleBulkApplyTemplateClick}>
{translate('permission_templates.bulk_apply_permission_template')}
</Button>
{this.props.qualifiers === 'TRK' && (
<Button
className="js-delete spacer-left button-red"
- disabled={this.props.total === 0}
- onClick={this.handleDeleteClick}>
+ disabled={this.props.selection.length === 0}
+ onClick={this.handleDeleteClick}
+ title={
+ this.props.selection.length === 0
+ ? translate('permission_templates.select_to_delete')
+ : translate('permission_templates.delete_selected')
+ }>
{translate('delete')}
</Button>
)}
expect(shallowRender()).toMatchSnapshot();
});
+it('disables the delete and bulk apply buttons unless a project is selected', () => {
+ const wrapper = shallowRender();
+ expect(wrapper.find('Button.js-delete').prop('disabled')).toBe(true);
+ expect(wrapper.find('Button.js-bulk-apply-permission-template').prop('disabled')).toBe(true);
+
+ wrapper.setProps({ selection: ['foo'] });
+ expect(wrapper.find('Button.js-delete').prop('disabled')).toBe(false);
+ expect(wrapper.find('Button.js-bulk-apply-permission-template').prop('disabled')).toBe(false);
+});
+
it('render qualifiers filter', () => {
expect(shallowRender({ topLevelQualifiers: ['TRK', 'VW', 'APP'] })).toMatchSnapshot();
});
>
<Button
className="js-bulk-apply-permission-template"
- disabled={false}
+ disabled={true}
onClick={[Function]}
>
permission_templates.bulk_apply_permission_template
</Button>
<Button
className="js-delete spacer-left button-red"
- disabled={false}
+ disabled={true}
onClick={[Function]}
+ title="permission_templates.select_to_delete"
>
delete
</Button>
>
<Button
className="js-bulk-apply-permission-template"
- disabled={false}
+ disabled={true}
onClick={[Function]}
>
permission_templates.bulk_apply_permission_template
</Button>
<Button
className="js-delete spacer-left button-red"
- disabled={false}
+ disabled={true}
onClick={[Function]}
+ title="permission_templates.select_to_delete"
>
delete
</Button>
permission_templates.bulk_apply_permission_template=Bulk Apply Permission Template
permission_templates.bulk_apply_permission_template.apply_to_selected=You're about to apply the selected permission template to {0} selected item(s).
permission_templates.bulk_apply_permission_template.apply_to_all=You're about to apply the selected permission template to {0} item(s).
+permission_templates.select_to_delete=You must select at least one item
+permission_templates.delete_selected=Delete all selected items
#------------------------------------------------------------------------------