Reflect disable state for permissions form

This commit is contained in:
shamoon 2024-12-11 00:33:36 -08:00
parent 4f9fb97618
commit 252c5378f6
No known key found for this signature in database
2 changed files with 15 additions and 0 deletions

View File

@ -66,4 +66,11 @@ describe('PermissionsFormComponent', () => {
},
})
})
it('should disable form on disabled state change', () => {
component.setDisabledState(false)
expect(component.form.disabled).toBeFalsy()
component.setDisabledState(true)
expect(component.form.disabled).toBeTruthy()
})
})

View File

@ -66,4 +66,12 @@ export class PermissionsFormComponent
writeValue(newValue: any): void {
this.form.patchValue(newValue, { emitEvent: false })
}
public setDisabledState(isDisabled: boolean): void {
if (isDisabled) {
this.form.disable()
} else {
this.form.enable()
}
}
}