Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Chore: add coverage for missing lines in patch change

shamoon5a278381e38c
diff --git a/src-ui/src/app/components/document-detail/document-detail.component.spec.ts b/src-ui/src/app/components/document-detail/document-detail.component.spec.ts
index 5b94c4922..9be722c3a 100644
--- a/src-ui/src/app/components/document-detail/document-detail.component.spec.ts
+++ b/src-ui/src/app/components/document-detail/document-detail.component.spec.ts
@@ -992,6 +992,44 @@ describe('DocumentDetailComponent', () => {
)
})
+ it('should correctly determine changed fields', () => {
+ initNormally()
+ expect(component['getChangedFields']()).toEqual({
+ id: doc.id,
+ })
+ component.documentForm.get('title').setValue('Foo Bar')
+ component.documentForm.get('permissions_form').setValue({
+ owner: 1,
+ set_permissions: {
+ view: {
+ users: [2],
+ groups: [],
+ },
+ change: {
+ users: [3],
+ groups: [],
+ },
+ },
+ })
+ component.documentForm.get('title').markAsDirty()
+ component.documentForm.get('permissions_form').markAsDirty()
+ expect(component['getChangedFields']()).toEqual({
+ id: doc.id,
+ title: 'Foo Bar',
+ owner: 1,
+ set_permissions: {
+ view: {
+ users: [2],
+ groups: [],
+ },
+ change: {
+ users: [3],
+ groups: [],
+ },
+ },
+ })
+ })
+
it('should show custom field errors', () => {
initNormally()
component.error = {