test: write tests for role management (#1396)
This commit is contained in:
@@ -66,10 +66,15 @@ export default function PermissionSettings(props: PermissionSettingsProps) {
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog open onClose={cancel} sx={{ display: open ? 'block' : 'none' }}>
|
||||
<Dialog
|
||||
open
|
||||
onClose={cancel}
|
||||
sx={{ display: open ? 'block' : 'none' }}
|
||||
data-test={`${subject}-role-conditions-modal`}
|
||||
>
|
||||
<DialogTitle>{formatMessage('permissionSettings.title')}</DialogTitle>
|
||||
|
||||
<DialogContent>
|
||||
<DialogContent data-test="role-conditions-modal-body">
|
||||
<TableContainer component={Paper}>
|
||||
<Table>
|
||||
<TableHead>
|
||||
@@ -113,6 +118,7 @@ export default function PermissionSettings(props: PermissionSettingsProps) {
|
||||
{action.subjects.includes(subject) && (
|
||||
<ControlledCheckbox
|
||||
name={`${fieldPrefix}.${action.key}.conditions.${condition.key}`}
|
||||
dataTest={`${condition.key}-${action.key.toLowerCase()}-checkbox`}
|
||||
defaultValue={defaultChecked}
|
||||
disabled={
|
||||
getValues(
|
||||
|
@@ -62,6 +62,7 @@ const PermissionCatalogField = ({
|
||||
<TableRow
|
||||
key={subject.key}
|
||||
sx={{ '&:last-child td': { border: 0 } }}
|
||||
data-test={`${subject.key}-permission-row`}
|
||||
>
|
||||
<TableCell scope="row">
|
||||
<Typography variant="subtitle2">{subject.label}</Typography>
|
||||
@@ -74,6 +75,7 @@ const PermissionCatalogField = ({
|
||||
<ControlledCheckbox
|
||||
disabled={disabled}
|
||||
name={`${name}.${subject.key}.${action.key}.value`}
|
||||
dataTest={`${action.key.toLowerCase()}-checkbox`}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -89,6 +91,7 @@ const PermissionCatalogField = ({
|
||||
size="small"
|
||||
onClick={() => setDialogName(subject.key)}
|
||||
disabled={disabled}
|
||||
data-test="permission-settings-button"
|
||||
>
|
||||
<SettingsIcon />
|
||||
</IconButton>
|
||||
|
Reference in New Issue
Block a user