cat-documents-ng 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +322 -322
- package/Shared/components/confirmation-dialog/confirmation-dialog.component.d.ts +44 -0
- package/Shared/components/table-primary/table-primary.component.d.ts +31 -0
- package/Shared/components/table-primary/table-primary.model.d.ts +19 -0
- package/Shared/constant/ERROR.d.ts +52 -0
- package/Shared/constant/SHARED.d.ts +546 -0
- package/{src/Shared/constant/URLS.ts → Shared/constant/URLS.d.ts} +25 -31
- package/Shared/services/app-config.service.d.ts +51 -0
- package/{src/Shared/services/global-error.handler.ts → Shared/services/global-error.handler.d.ts} +9 -11
- package/Shared/services/session.service.d.ts +46 -0
- package/Shared/shared.module.d.ts +14 -0
- package/fesm2022/cat-documents-ng.mjs +11405 -0
- package/fesm2022/cat-documents-ng.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/document/components/document-actions/document-actions.component.d.ts +78 -0
- package/lib/document/components/document-container/document-container.component.d.ts +162 -0
- package/lib/document/components/document-content-viewer/document-content-viewer.component.d.ts +291 -0
- package/lib/document/components/document-history/document-history.component.d.ts +160 -0
- package/lib/document/components/document-list/document-list.component.d.ts +299 -0
- package/lib/document/components/document-list-item/document-list-item.component.d.ts +28 -0
- package/lib/document/components/document-search/document-search.component.d.ts +77 -0
- package/lib/document/components/document-status/document-status.component.d.ts +24 -0
- package/lib/document/components/document-upload/document-upload.component.d.ts +321 -0
- package/lib/document/components/document-viewer/document-viewer.component.d.ts +137 -0
- package/lib/document/components/document-zoom-controls/document-zoom-controls.component.d.ts +33 -0
- package/lib/document/components/documents-menu/documents-menu.component.d.ts +110 -0
- package/{src/lib/document/components/folder-block/folder-block.component.ts → lib/document/components/folder-block/folder-block.component.d.ts} +12 -28
- package/lib/document/components/folder-container/folder-container.component.d.ts +162 -0
- package/lib/document/components/linked-document/linked-document.component.d.ts +39 -0
- package/lib/document/components/request-document/request-document.component.d.ts +69 -0
- package/lib/document/components/sidebar/sidebar.component.d.ts +109 -0
- package/lib/document/components/user-list/user-list.component.d.ts +34 -0
- package/lib/document/constant/DOCUMENT_HISTORY.d.ts +41 -0
- package/lib/document/directives/document.directive.d.ts +20 -0
- package/lib/document/directives/permission.directive.d.ts +38 -0
- package/lib/document/document.module.d.ts +60 -0
- package/{src/lib/document/models/document-alert.model.ts → lib/document/models/document-alert.model.d.ts} +4 -11
- package/lib/document/models/document-category.model.d.ts +24 -0
- package/lib/document/models/document-history.model.d.ts +94 -0
- package/lib/document/models/document-list-response.model.d.ts +33 -0
- package/lib/document/models/document-type.model.d.ts +37 -0
- package/lib/document/models/document.model.d.ts +44 -0
- package/{src/lib/document/models/folder.model.ts → lib/document/models/folder.model.d.ts} +4 -10
- package/lib/document/models/status-data.model.d.ts +27 -0
- package/lib/document/models/uploaded-file-response.model.d.ts +7 -0
- package/lib/document/models/user-list.model.d.ts +8 -0
- package/lib/document/services/csv-parser.service.d.ts +88 -0
- package/lib/document/services/document-actions.service.d.ts +48 -0
- package/lib/document/services/document-content-type.service.d.ts +85 -0
- package/lib/document/services/document-history-style.service.d.ts +34 -0
- package/lib/document/services/document-history.service.d.ts +42 -0
- package/lib/document/services/document-http.service.d.ts +179 -0
- package/lib/document/services/document-list.service.d.ts +74 -0
- package/lib/document/services/document-menu.service.d.ts +122 -0
- package/lib/document/services/document-scroll.service.d.ts +55 -0
- package/lib/document/services/document-table-builder.service.d.ts +38 -0
- package/lib/document/services/document-upload-business.service.d.ts +107 -0
- package/lib/document/services/document-upload-data.service.d.ts +40 -0
- package/lib/document/services/document-upload-form.service.d.ts +41 -0
- package/lib/document/services/document-upload.service.d.ts +99 -0
- package/lib/document/services/document-viewer.service.d.ts +97 -0
- package/lib/document/services/document-zoom.service.d.ts +81 -0
- package/lib/document/services/document.service.d.ts +161 -0
- package/lib/document/services/eml-parser.service.d.ts +116 -0
- package/lib/document/services/excel-parser.service.d.ts +169 -0
- package/lib/document/services/file-format.service.d.ts +34 -0
- package/lib/document/services/status-calculator.service.d.ts +20 -0
- package/lib/document/services/user-list.service.d.ts +29 -0
- package/lib/document/state/document.query.d.ts +243 -0
- package/{src/lib/document/state/document.service.ts → lib/document/state/document.service.d.ts} +15 -46
- package/lib/document/state/document.state.d.ts +61 -0
- package/lib/document/state/document.store.d.ts +56 -0
- package/package.json +11 -5
- package/{src/public-api.ts → public-api.d.ts} +0 -4
- package/ng-package.json +0 -10
- package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.html +0 -3
- package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.scss +0 -13
- package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.spec.ts +0 -70
- package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.ts +0 -133
- package/src/Shared/components/table-primary/table-primary.component.html +0 -66
- package/src/Shared/components/table-primary/table-primary.component.scss +0 -227
- package/src/Shared/components/table-primary/table-primary.component.spec.ts +0 -23
- package/src/Shared/components/table-primary/table-primary.component.ts +0 -143
- package/src/Shared/components/table-primary/table-primary.model.ts +0 -21
- package/src/Shared/constant/ERROR.ts +0 -55
- package/src/Shared/constant/PERMISSIONS.ts +0 -17
- package/src/Shared/constant/SHARED.ts +0 -936
- package/src/Shared/services/app-config.service.spec.ts +0 -19
- package/src/Shared/services/app-config.service.ts +0 -73
- package/src/Shared/services/session.service.spec.ts +0 -16
- package/src/Shared/services/session.service.ts +0 -76
- package/src/Shared/shared.module.ts +0 -25
- package/src/lib/document/components/csv-viewer/csv-viewer.component.ts +0 -1
- package/src/lib/document/components/document-actions/document-actions.component.html +0 -59
- package/src/lib/document/components/document-actions/document-actions.component.scss +0 -362
- package/src/lib/document/components/document-actions/document-actions.component.spec.ts +0 -297
- package/src/lib/document/components/document-actions/document-actions.component.ts +0 -163
- package/src/lib/document/components/document-container/document-container.component.html +0 -36
- package/src/lib/document/components/document-container/document-container.component.scss +0 -144
- package/src/lib/document/components/document-container/document-container.component.spec.ts +0 -110
- package/src/lib/document/components/document-container/document-container.component.ts +0 -363
- package/src/lib/document/components/document-content-viewer/document-content-viewer.component.html +0 -332
- package/src/lib/document/components/document-content-viewer/document-content-viewer.component.scss +0 -1877
- package/src/lib/document/components/document-content-viewer/document-content-viewer.component.spec.ts +0 -258
- package/src/lib/document/components/document-content-viewer/document-content-viewer.component.ts +0 -664
- package/src/lib/document/components/document-history/document-history.component.html +0 -96
- package/src/lib/document/components/document-history/document-history.component.scss +0 -392
- package/src/lib/document/components/document-history/document-history.component.spec.ts +0 -93
- package/src/lib/document/components/document-history/document-history.component.ts +0 -373
- package/src/lib/document/components/document-list/document-list.component.html +0 -46
- package/src/lib/document/components/document-list/document-list.component.scss +0 -513
- package/src/lib/document/components/document-list/document-list.component.spec.ts +0 -486
- package/src/lib/document/components/document-list/document-list.component.ts +0 -682
- package/src/lib/document/components/document-list-item/document-list-item.component.html +0 -36
- package/src/lib/document/components/document-list-item/document-list-item.component.scss +0 -34
- package/src/lib/document/components/document-list-item/document-list-item.component.spec.ts +0 -75
- package/src/lib/document/components/document-list-item/document-list-item.component.ts +0 -40
- package/src/lib/document/components/document-search/document-search.component.html +0 -64
- package/src/lib/document/components/document-search/document-search.component.scss +0 -206
- package/src/lib/document/components/document-search/document-search.component.spec.ts +0 -82
- package/src/lib/document/components/document-search/document-search.component.ts +0 -163
- package/src/lib/document/components/document-status/document-status.component.html +0 -31
- package/src/lib/document/components/document-status/document-status.component.scss +0 -192
- package/src/lib/document/components/document-status/document-status.component.spec.ts +0 -23
- package/src/lib/document/components/document-status/document-status.component.ts +0 -87
- package/src/lib/document/components/document-upload/document-upload.component.html +0 -160
- package/src/lib/document/components/document-upload/document-upload.component.scss +0 -235
- package/src/lib/document/components/document-upload/document-upload.component.spec.ts +0 -95
- package/src/lib/document/components/document-upload/document-upload.component.ts +0 -668
- package/src/lib/document/components/document-viewer/document-viewer.component.html +0 -50
- package/src/lib/document/components/document-viewer/document-viewer.component.scss +0 -187
- package/src/lib/document/components/document-viewer/document-viewer.component.spec.ts +0 -79
- package/src/lib/document/components/document-viewer/document-viewer.component.ts +0 -261
- package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.html +0 -48
- package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.scss +0 -320
- package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.spec.ts +0 -59
- package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.ts +0 -150
- package/src/lib/document/components/documents-menu/documents-menu.component.html +0 -44
- package/src/lib/document/components/documents-menu/documents-menu.component.scss +0 -363
- package/src/lib/document/components/documents-menu/documents-menu.component.spec.ts +0 -23
- package/src/lib/document/components/documents-menu/documents-menu.component.ts +0 -316
- package/src/lib/document/components/folder-block/folder-block.component.html +0 -46
- package/src/lib/document/components/folder-block/folder-block.component.scss +0 -9
- package/src/lib/document/components/folder-block/folder-block.component.spec.ts +0 -70
- package/src/lib/document/components/folder-container/folder-container.component.html +0 -56
- package/src/lib/document/components/folder-container/folder-container.component.scss +0 -20
- package/src/lib/document/components/folder-container/folder-container.component.spec.ts +0 -27
- package/src/lib/document/components/folder-container/folder-container.component.ts +0 -328
- package/src/lib/document/components/linked-document/linked-document.component.html +0 -23
- package/src/lib/document/components/linked-document/linked-document.component.scss +0 -10
- package/src/lib/document/components/linked-document/linked-document.component.spec.ts +0 -61
- package/src/lib/document/components/linked-document/linked-document.component.ts +0 -49
- package/src/lib/document/components/request-document/request-document.component.html +0 -86
- package/src/lib/document/components/request-document/request-document.component.scss +0 -16
- package/src/lib/document/components/request-document/request-document.component.ts +0 -278
- package/src/lib/document/components/sidebar/sidebar.component.html +0 -75
- package/src/lib/document/components/sidebar/sidebar.component.scss +0 -157
- package/src/lib/document/components/sidebar/sidebar.component.spec.ts +0 -114
- package/src/lib/document/components/sidebar/sidebar.component.ts +0 -223
- package/src/lib/document/components/user-list/user-list.component.html +0 -33
- package/src/lib/document/components/user-list/user-list.component.scss +0 -118
- package/src/lib/document/components/user-list/user-list.component.spec.ts +0 -23
- package/src/lib/document/components/user-list/user-list.component.ts +0 -181
- package/src/lib/document/constant/DOCUMENT_HISTORY.ts +0 -52
- package/src/lib/document/directives/document.directive.ts +0 -32
- package/src/lib/document/directives/permission.directive.spec.ts +0 -0
- package/src/lib/document/directives/permission.directive.ts +0 -72
- package/src/lib/document/document.module.ts +0 -351
- package/src/lib/document/models/document-category.model.ts +0 -30
- package/src/lib/document/models/document-history.model.ts +0 -109
- package/src/lib/document/models/document-list-response.model.ts +0 -37
- package/src/lib/document/models/document-type.model.ts +0 -44
- package/src/lib/document/models/document.model.ts +0 -53
- package/src/lib/document/models/status-data.model.ts +0 -31
- package/src/lib/document/models/uploaded-file-response.model.ts +0 -7
- package/src/lib/document/models/user-list.model.ts +0 -10
- package/src/lib/document/services/csv-parser.service.spec.ts +0 -97
- package/src/lib/document/services/csv-parser.service.ts +0 -303
- package/src/lib/document/services/document-actions.service.ts +0 -125
- package/src/lib/document/services/document-content-type.service.ts +0 -193
- package/src/lib/document/services/document-history-style.service.ts +0 -138
- package/src/lib/document/services/document-history.service.ts +0 -129
- package/src/lib/document/services/document-http.service.spec.ts +0 -119
- package/src/lib/document/services/document-http.service.ts +0 -497
- package/src/lib/document/services/document-list.service.ts +0 -195
- package/src/lib/document/services/document-menu.service.ts +0 -277
- package/src/lib/document/services/document-scroll.service.ts +0 -138
- package/src/lib/document/services/document-severity.service.ts +0 -98
- package/src/lib/document/services/document-table-builder.service.ts +0 -82
- package/src/lib/document/services/document-upload-business.service.ts +0 -326
- package/src/lib/document/services/document-upload-data.service.ts +0 -82
- package/src/lib/document/services/document-upload-form.service.ts +0 -149
- package/src/lib/document/services/document-upload.service.spec.ts +0 -99
- package/src/lib/document/services/document-upload.service.ts +0 -209
- package/src/lib/document/services/document-viewer.service.ts +0 -279
- package/src/lib/document/services/document-zoom.service.spec.ts +0 -56
- package/src/lib/document/services/document-zoom.service.ts +0 -164
- package/src/lib/document/services/document.service.ts +0 -356
- package/src/lib/document/services/eml-parser.service.ts +0 -444
- package/src/lib/document/services/excel-parser.service.spec.ts +0 -66
- package/src/lib/document/services/excel-parser.service.ts +0 -483
- package/src/lib/document/services/file-format.service.spec.ts +0 -16
- package/src/lib/document/services/file-format.service.ts +0 -63
- package/src/lib/document/services/status-calculator.service.ts +0 -44
- package/src/lib/document/services/user-list.service.ts +0 -77
- package/src/lib/document/state/document.query.ts +0 -378
- package/src/lib/document/state/document.state.ts +0 -100
- package/src/lib/document/state/document.store.ts +0 -200
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -11
- package/tsconfig.spec.json +0 -15
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<div class="card p-0 folder-info">
|
|
2
|
-
<div class="text-900 text-xl font-semibold ml-2 mb-1">Folders</div>
|
|
3
|
-
<div class="grid m-0">
|
|
4
|
-
<div *ngFor="let folder of folderList" class="col-12 md:col-6 xl:col-4 container-wrapper">
|
|
5
|
-
<div
|
|
6
|
-
class="p-3 border-1 h-full surface-border flex flex-column justify-content-between hover:surface-100 cursor-pointer border-round"
|
|
7
|
-
(click)="handleClickForFilter(folder._id)"
|
|
8
|
-
>
|
|
9
|
-
<div class="icon">
|
|
10
|
-
<img src="../../../../assets/images/FolderImg.png" alt="" />
|
|
11
|
-
</div>
|
|
12
|
-
<div class="flex flex-column">
|
|
13
|
-
<span class="text-600 mt-2"> {{ folder.documentCount }} Files </span>
|
|
14
|
-
<span class="text-900 text-lg mt-2 mb-2 font-semibold font-medium">
|
|
15
|
-
{{ folder.folderName }}
|
|
16
|
-
</span>
|
|
17
|
-
</div>
|
|
18
|
-
<hr />
|
|
19
|
-
<div class="flex justify-content-between">
|
|
20
|
-
<div class="flex flex-column">
|
|
21
|
-
<span>Missing</span>
|
|
22
|
-
<span
|
|
23
|
-
[ngClass]="{
|
|
24
|
-
'text-pink-500': missingFileCount > 0,
|
|
25
|
-
'text-green-500': missingFileCount === 0
|
|
26
|
-
}"
|
|
27
|
-
>
|
|
28
|
-
{{ missingFileCount }}
|
|
29
|
-
</span>
|
|
30
|
-
</div>
|
|
31
|
-
<div class="flex flex-column">
|
|
32
|
-
<span>Pending</span>
|
|
33
|
-
<span
|
|
34
|
-
[ngClass]="{
|
|
35
|
-
'text-yellow-500': pendingFileCount > 0,
|
|
36
|
-
'text-green-500': pendingFileCount === 0
|
|
37
|
-
}"
|
|
38
|
-
>
|
|
39
|
-
{{ pendingFileCount }}
|
|
40
|
-
</span>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { FolderBlockComponent } from './folder-block.component';
|
|
3
|
-
import { SHARED } from '../../../../Shared/constant/SHARED';
|
|
4
|
-
import { DocumentStore } from '../../state/document.store';
|
|
5
|
-
import { FolderBlockModel } from '../../models/folder.model';
|
|
6
|
-
|
|
7
|
-
describe('FolderBlockComponent', () => {
|
|
8
|
-
let component: FolderBlockComponent;
|
|
9
|
-
let fixture: ComponentFixture<FolderBlockComponent>;
|
|
10
|
-
let mockDocumentStore: jasmine.SpyObj<DocumentStore>;
|
|
11
|
-
|
|
12
|
-
beforeEach(async () => {
|
|
13
|
-
mockDocumentStore = jasmine.createSpyObj('DocumentStore', ['setParentDocumentTypeId']); // Include the method here
|
|
14
|
-
|
|
15
|
-
await TestBed.configureTestingModule({
|
|
16
|
-
declarations: [FolderBlockComponent],
|
|
17
|
-
providers: [
|
|
18
|
-
{ provide: DocumentStore, useValue: mockDocumentStore }
|
|
19
|
-
],
|
|
20
|
-
}).compileComponents();
|
|
21
|
-
|
|
22
|
-
fixture = TestBed.createComponent(FolderBlockComponent);
|
|
23
|
-
component = fixture.componentInstance;
|
|
24
|
-
|
|
25
|
-
// Mock folder blocks input
|
|
26
|
-
component.folderList = [
|
|
27
|
-
{ _id: '1', folderName: 'Folder 1', documentCount: 5 },
|
|
28
|
-
{ _id: '2', folderName: 'Folder 2', documentCount: 3 },
|
|
29
|
-
] as FolderBlockModel[];
|
|
30
|
-
|
|
31
|
-
fixture.detectChanges();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
it('should create', () => {
|
|
36
|
-
expect(component).toBeTruthy();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('should render the folder blocks correctly', () => {
|
|
40
|
-
const folderElements = fixture.debugElement.nativeElement.querySelectorAll('.grid .col-12');
|
|
41
|
-
expect(folderElements.length).toBe(2); // Should match the length of folderBlocks input
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('should display the correct file count for each folder', () => {
|
|
45
|
-
const folderTextElements = fixture.debugElement.nativeElement.querySelectorAll('.text-600');
|
|
46
|
-
expect(folderTextElements[0].textContent).toContain('5 Files');
|
|
47
|
-
expect(folderTextElements[1].textContent).toContain('3 Files');
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('should return correct folderBlockId from handleClickForFilter', () => {
|
|
51
|
-
const validFolderBlockId = '1';
|
|
52
|
-
const invalidFolderBlockId = '';
|
|
53
|
-
|
|
54
|
-
expect(component.handleClickForFilter(validFolderBlockId)).toBe(validFolderBlockId);
|
|
55
|
-
expect(component.handleClickForFilter(invalidFolderBlockId)).toBe(SHARED.EMPTY);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('should display the missing and pending file counts correctly', () => {
|
|
59
|
-
const missingFileCountElements = fixture.debugElement.nativeElement.querySelectorAll('.text-pink-500');
|
|
60
|
-
const pendingFileCountElements = fixture.debugElement.nativeElement.querySelectorAll('.text-yellow-500');
|
|
61
|
-
|
|
62
|
-
expect(missingFileCountElements.length).toBeGreaterThan(0); // Check if any element with `text-pink-500` class is present
|
|
63
|
-
expect(pendingFileCountElements.length).toBeGreaterThan(0); // Check if any element with `text-yellow-500` class is present
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it('should set the missingFileCount and pendingFileCount to SHARED constants', () => {
|
|
67
|
-
expect(component.missingFileCount).toBe(SHARED.MISSINGCOUNT);
|
|
68
|
-
expect(component.pendingFileCount).toBe(SHARED.PENDINGCOUNT);
|
|
69
|
-
});
|
|
70
|
-
});
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<document-search [contextId]="contextId" (onActionClick)="openDocumentUploadSidebar()" (onRequestClick)="openRequestDocumentSidebar()"></document-search>
|
|
3
|
-
<div class="user-list-wrapper" [@slideInOut]="userListAnimationState">
|
|
4
|
-
<lib-user-list [userList]="userList" [categories]="categories"></lib-user-list>
|
|
5
|
-
</div>
|
|
6
|
-
<lib-document-status [contextId]="contextId" [statusData]="statusData"></lib-document-status>
|
|
7
|
-
|
|
8
|
-
<!-- Document Upload Sidebar -->
|
|
9
|
-
<lib-sidebar
|
|
10
|
-
#uploadSidebar
|
|
11
|
-
[(visible)]="isDocumentUploadSidebarOpen"
|
|
12
|
-
position="right"
|
|
13
|
-
width="600px"
|
|
14
|
-
title="Upload Documents"
|
|
15
|
-
[showCloseButton]="true"
|
|
16
|
-
[showSaveButton]="true"
|
|
17
|
-
[saveButtonText]="'Save'"
|
|
18
|
-
[saveButtonDisabled]="isSaveButtonDisabled"
|
|
19
|
-
[successMessage]="'Document Saved Successfully'"
|
|
20
|
-
[hasUnsavedChanges]="hasUnsavedChanges"
|
|
21
|
-
(onHide)="onDocumentUploadSidebarHide()"
|
|
22
|
-
(onSave)="onDocumentUploadSave()"
|
|
23
|
-
(onClose)="onDocumentUploadSidebarCloseWithUnsavedChanges()"
|
|
24
|
-
>
|
|
25
|
-
<lib-document-upload
|
|
26
|
-
[contextId]="contextId"
|
|
27
|
-
(onFormValidationChange)="onFormValidationChange()"
|
|
28
|
-
(onUploadSuccess)="onDocumentUploadSuccess()"
|
|
29
|
-
(onUploadError)="onDocumentUploadError($event)"
|
|
30
|
-
></lib-document-upload>
|
|
31
|
-
</lib-sidebar>
|
|
32
|
-
|
|
33
|
-
<lib-sidebar
|
|
34
|
-
#requestSidebar
|
|
35
|
-
[(visible)]="isRequestDocumentSidebarOpen"
|
|
36
|
-
position="right"
|
|
37
|
-
width="600px"
|
|
38
|
-
title="Request Document"
|
|
39
|
-
[showCloseButton]="true"
|
|
40
|
-
[showSaveButton]="true"
|
|
41
|
-
[saveButtonText]="'Save'"
|
|
42
|
-
[successMessage]="'Document Requested'"
|
|
43
|
-
[saveButtonDisabled]="isRequestSaveButtonDisabled"
|
|
44
|
-
[hasUnsavedChanges]="requestHasUnsavedChanges"
|
|
45
|
-
(onHide)="onRequestDocumentSidebarHide()"
|
|
46
|
-
(onSave)="onRequestDocumentSave()"
|
|
47
|
-
(onClose)="onRequestDocumentSidebarCloseWithUnsavedChanges()"
|
|
48
|
-
>
|
|
49
|
-
<lib-request-document
|
|
50
|
-
[contextId]="contextId"
|
|
51
|
-
(onFormValidationChange)="onRequestFormValidationChange()"
|
|
52
|
-
(onRequestSuccess)="onRequestDocumentSuccess()"
|
|
53
|
-
(onRequestError)="onRequestDocumentError($event)"
|
|
54
|
-
(hasUnsavedChangesChange)="onRequestUnsavedChange($event)"
|
|
55
|
-
></lib-request-document>
|
|
56
|
-
</lib-sidebar>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
.user-list-wrapper {
|
|
2
|
-
overflow: hidden;
|
|
3
|
-
margin-bottom: 1rem;
|
|
4
|
-
|
|
5
|
-
// Ensure smooth transitions for child elements
|
|
6
|
-
::ng-deep * {
|
|
7
|
-
transition: opacity 0.2s ease-in-out;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// Additional styling for better animation experience
|
|
12
|
-
.user-list-wrapper.ng-animating {
|
|
13
|
-
pointer-events: none;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// Ensure the user list component itself has proper styling
|
|
17
|
-
::ng-deep lib-user-list {
|
|
18
|
-
display: block;
|
|
19
|
-
width: 100%;
|
|
20
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { Listbox, ListboxModule } from 'primeng/listbox';
|
|
3
|
-
import { TimelineModule } from 'primeng/timeline';
|
|
4
|
-
import { FormsModule } from '@angular/forms';
|
|
5
|
-
import { CheckboxModule } from 'primeng/checkbox';
|
|
6
|
-
import { FolderContainerComponent } from './folder-container.component';
|
|
7
|
-
import { FolderBlockComponent } from '../folder-block/folder-block.component';
|
|
8
|
-
|
|
9
|
-
describe('FolderContainerComponent', () => {
|
|
10
|
-
let component: FolderContainerComponent;
|
|
11
|
-
let fixture: ComponentFixture<FolderContainerComponent>;
|
|
12
|
-
|
|
13
|
-
beforeEach(async () => {
|
|
14
|
-
await TestBed.configureTestingModule({
|
|
15
|
-
declarations: [FolderContainerComponent , FolderBlockComponent],
|
|
16
|
-
imports : [ListboxModule, TimelineModule, FormsModule, CheckboxModule]
|
|
17
|
-
}).compileComponents();
|
|
18
|
-
|
|
19
|
-
fixture = TestBed.createComponent(FolderContainerComponent);
|
|
20
|
-
component = fixture.componentInstance;
|
|
21
|
-
fixture.detectChanges();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('should create', () => {
|
|
25
|
-
expect(component).toBeTruthy();
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
import { Component, Input, OnInit, OnDestroy, ViewChild } from '@angular/core';
|
|
2
|
-
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
3
|
-
import {SHARED } from '../../../../Shared/constant/SHARED';
|
|
4
|
-
import { DocumentModel } from '../../models/document.model';
|
|
5
|
-
import { FolderBlockModel } from '../../models/folder.model';
|
|
6
|
-
import { DocumentQuery } from '../../state/document.query';
|
|
7
|
-
import { UserListModel } from '../../models/user-list.model';
|
|
8
|
-
import { StatusDataModel } from '../../models/status-data.model';
|
|
9
|
-
import { DocumentCategory } from '../../models/document-category.model';
|
|
10
|
-
import { DocumentUploadComponent } from '../document-upload/document-upload.component';
|
|
11
|
-
import { RequestDocumentComponent } from '../request-document/request-document.component';
|
|
12
|
-
import { DocumentHelperService } from '../../services/document.service';
|
|
13
|
-
import { SidebarComponent } from '../sidebar/sidebar.component';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* The `FolderContainerComponent` is responsible for rendering a container
|
|
17
|
-
* that displays a list of documents and associated folder panel data.
|
|
18
|
-
* This component utilizes the `FOLDERPANEL` constant for folder panel data
|
|
19
|
-
* and accepts a document list input of type `DocumentModel`.
|
|
20
|
-
*/
|
|
21
|
-
@Component({
|
|
22
|
-
selector: 'lib-folder-container',
|
|
23
|
-
standalone: false,
|
|
24
|
-
templateUrl: './folder-container.component.html',
|
|
25
|
-
styleUrl: './folder-container.component.scss',
|
|
26
|
-
animations: [
|
|
27
|
-
trigger('slideInOut', [
|
|
28
|
-
state('visible', style({
|
|
29
|
-
height: '*',
|
|
30
|
-
opacity: 1,
|
|
31
|
-
transform: 'translateY(0)',
|
|
32
|
-
overflow: 'hidden',
|
|
33
|
-
marginBottom: '1rem',
|
|
34
|
-
visibility: 'visible'
|
|
35
|
-
})),
|
|
36
|
-
state('hidden', style({
|
|
37
|
-
height: '0px',
|
|
38
|
-
opacity: 0,
|
|
39
|
-
transform: 'translateY(-20px)',
|
|
40
|
-
overflow: 'hidden',
|
|
41
|
-
marginBottom: '0px',
|
|
42
|
-
visibility: 'hidden'
|
|
43
|
-
})),
|
|
44
|
-
transition('visible => hidden', [
|
|
45
|
-
animate('250ms cubic-bezier(0.4, 0.0, 0.2, 1)')
|
|
46
|
-
]),
|
|
47
|
-
transition('hidden => visible', [
|
|
48
|
-
animate('300ms cubic-bezier(0.0, 0.0, 0.2, 1)')
|
|
49
|
-
])
|
|
50
|
-
])
|
|
51
|
-
]
|
|
52
|
-
})
|
|
53
|
-
export class FolderContainerComponent implements OnInit {
|
|
54
|
-
/**
|
|
55
|
-
* A list of documents passed as input to the component.
|
|
56
|
-
* Represents the document data to be displayed in the folder container.
|
|
57
|
-
*/
|
|
58
|
-
@Input() documentList?: DocumentModel[];
|
|
59
|
-
/**
|
|
60
|
-
* A list of documents passed as input to the component.
|
|
61
|
-
* Represents the document data to be displayed in the folder container.
|
|
62
|
-
*/
|
|
63
|
-
@Input() folderList: FolderBlockModel[] = SHARED.EMPTY_ARRAY;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* The context ID for the folder container.
|
|
67
|
-
* @type {string}
|
|
68
|
-
*/
|
|
69
|
-
@Input() contextId: string = SHARED.EMPTY;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* The list of users passed as input to the component.
|
|
73
|
-
* @type {UserListModel[]}
|
|
74
|
-
*/
|
|
75
|
-
@Input() userList: UserListModel[] = SHARED.EMPTY_ARRAY;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* The status data passed as input to the component.
|
|
79
|
-
* @type {StatusDataModel[]}
|
|
80
|
-
*/
|
|
81
|
-
@Input() statusData: StatusDataModel[] = SHARED.EMPTY_ARRAY;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* The document categories passed as input to the component.
|
|
85
|
-
* @type {DocumentCategory[]}
|
|
86
|
-
*/
|
|
87
|
-
@Input() categories: DocumentCategory[] = SHARED.EMPTY_ARRAY;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Flag to control user list visibility
|
|
91
|
-
*/
|
|
92
|
-
showUserList: boolean = true;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Animation state for user list visibility
|
|
96
|
-
*/
|
|
97
|
-
userListAnimationState: string = SHARED.VISIBLE;
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Controls the visibility of the document upload sidebar
|
|
101
|
-
*/
|
|
102
|
-
isDocumentUploadSidebarOpen: boolean = false;
|
|
103
|
-
/**
|
|
104
|
-
* Controls the visibility of the request document sidebar
|
|
105
|
-
*/
|
|
106
|
-
isRequestDocumentSidebarOpen: boolean = false;
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Reference to the document upload component
|
|
110
|
-
*/
|
|
111
|
-
@ViewChild(DocumentUploadComponent) documentUploadComponent!: DocumentUploadComponent;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* References to the sidebars
|
|
115
|
-
*/
|
|
116
|
-
@ViewChild('uploadSidebar') uploadSidebarComponent!: SidebarComponent;
|
|
117
|
-
@ViewChild('requestSidebar') requestSidebarComponent!: SidebarComponent;
|
|
118
|
-
@ViewChild(RequestDocumentComponent) requestDocumentComponent!: RequestDocumentComponent;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Tracks whether the save button should be disabled
|
|
122
|
-
*/
|
|
123
|
-
isSaveButtonDisabled: boolean = false;
|
|
124
|
-
/** Tracks save button disabled for request document */
|
|
125
|
-
isRequestSaveButtonDisabled: boolean = true;
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Tracks whether there are unsaved changes in the document upload form
|
|
129
|
-
*/
|
|
130
|
-
hasUnsavedChanges: boolean = false;
|
|
131
|
-
/**
|
|
132
|
-
* Tracks whether there are unsaved changes in the request document form
|
|
133
|
-
*/
|
|
134
|
-
requestHasUnsavedChanges: boolean = false;
|
|
135
|
-
|
|
136
|
-
constructor(private documentQuery: DocumentQuery, private documentHelperService: DocumentHelperService) {}
|
|
137
|
-
|
|
138
|
-
ngOnInit(): void {
|
|
139
|
-
this.documentQuery.selectShowUserList().subscribe(show => {
|
|
140
|
-
this.showUserList = show;
|
|
141
|
-
this.userListAnimationState = show ? SHARED.VISIBLE : SHARED.HIDDEN;
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Called when the view is initialized to set up the save button state
|
|
147
|
-
*/
|
|
148
|
-
ngAfterViewInit(): void {
|
|
149
|
-
this.updateSaveButtonState();
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Updates the save button disabled state based on the document upload component
|
|
154
|
-
*/
|
|
155
|
-
updateSaveButtonState(): void {
|
|
156
|
-
if (this.documentUploadComponent) {
|
|
157
|
-
this.isSaveButtonDisabled = this.documentUploadComponent.getSaveButtonDisabled();
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Handles form validation changes from the document upload component
|
|
163
|
-
*/
|
|
164
|
-
onFormValidationChange(): void {
|
|
165
|
-
this.updateSaveButtonState();
|
|
166
|
-
// Check if there are actual unsaved changes
|
|
167
|
-
this.checkForUnsavedChanges();
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/** Updates request save button disabled state */
|
|
171
|
-
onRequestFormValidationChange(): void {
|
|
172
|
-
if (this.requestDocumentComponent) {
|
|
173
|
-
this.isRequestSaveButtonDisabled = this.requestDocumentComponent.getSaveButtonDisabled();
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Checks if there are unsaved changes in the document upload form
|
|
179
|
-
*/
|
|
180
|
-
private checkForUnsavedChanges(): void {
|
|
181
|
-
if (this.documentUploadComponent) {
|
|
182
|
-
// Check if files are uploaded or form has changes
|
|
183
|
-
const hasFiles = Boolean(this.documentUploadComponent.uploadedFiles && this.documentUploadComponent.uploadedFiles.length > 0);
|
|
184
|
-
const hasFormChanges = Boolean(
|
|
185
|
-
(this.documentUploadComponent.selectedAssignmentType && this.documentUploadComponent.selectedAssignmentType !== SHARED.EMPTY) ||
|
|
186
|
-
(this.documentUploadComponent.selectedApplicant && this.documentUploadComponent.selectedApplicant !== SHARED.EMPTY) ||
|
|
187
|
-
(this.documentUploadComponent.selectedCategory && this.documentUploadComponent.selectedCategory !== SHARED.EMPTY) ||
|
|
188
|
-
(this.documentUploadComponent.selectedDocumentType && this.documentUploadComponent.selectedDocumentType !== SHARED.EMPTY)
|
|
189
|
-
);
|
|
190
|
-
|
|
191
|
-
this.hasUnsavedChanges = hasFiles || hasFormChanges;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Opens the document upload sidebar
|
|
197
|
-
*/
|
|
198
|
-
openDocumentUploadSidebar(): void {
|
|
199
|
-
this.isDocumentUploadSidebarOpen = true;
|
|
200
|
-
this.hasUnsavedChanges = false; // Reset when opening
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Opens the request document sidebar
|
|
205
|
-
*/
|
|
206
|
-
openRequestDocumentSidebar(): void {
|
|
207
|
-
this.isRequestDocumentSidebarOpen = true;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Handles the document upload sidebar hide event
|
|
212
|
-
*/
|
|
213
|
-
onDocumentUploadSidebarHide(): void {
|
|
214
|
-
this.isDocumentUploadSidebarOpen = false;
|
|
215
|
-
this.hasUnsavedChanges = false;
|
|
216
|
-
if (this.documentUploadComponent) {
|
|
217
|
-
this.documentUploadComponent.resetForm();
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Handles the document upload sidebar close event (when close button is clicked or sidebar is dismissed)
|
|
223
|
-
*/
|
|
224
|
-
onDocumentUploadSidebarClose(): void {
|
|
225
|
-
this.isDocumentUploadSidebarOpen = false;
|
|
226
|
-
this.hasUnsavedChanges = false;
|
|
227
|
-
if (this.documentUploadComponent) {
|
|
228
|
-
this.documentUploadComponent.resetForm();
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Handles the document upload sidebar close with unsaved changes event
|
|
234
|
-
*/
|
|
235
|
-
onDocumentUploadSidebarCloseWithUnsavedChanges(): void {
|
|
236
|
-
this.isDocumentUploadSidebarOpen = false;
|
|
237
|
-
this.hasUnsavedChanges = false;
|
|
238
|
-
if (this.documentUploadComponent) {
|
|
239
|
-
this.documentUploadComponent.resetForm();
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Handles the request document sidebar hide event
|
|
245
|
-
*/
|
|
246
|
-
onRequestDocumentSidebarHide(): void {
|
|
247
|
-
this.isRequestDocumentSidebarOpen = false;
|
|
248
|
-
this.requestHasUnsavedChanges = false;
|
|
249
|
-
if (this.requestDocumentComponent) {
|
|
250
|
-
this.requestDocumentComponent.resetForm();
|
|
251
|
-
}
|
|
252
|
-
this.isRequestSaveButtonDisabled = true;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Handles the request document sidebar close with unsaved changes event
|
|
257
|
-
*/
|
|
258
|
-
onRequestDocumentSidebarCloseWithUnsavedChanges(): void {
|
|
259
|
-
this.isRequestDocumentSidebarOpen = false;
|
|
260
|
-
this.requestHasUnsavedChanges = false;
|
|
261
|
-
if (this.requestDocumentComponent) {
|
|
262
|
-
this.requestDocumentComponent.resetForm();
|
|
263
|
-
}
|
|
264
|
-
this.isRequestSaveButtonDisabled = true;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/** Invoked from sidebar Save button for request document */
|
|
268
|
-
onRequestDocumentSave(): void {
|
|
269
|
-
if (this.requestDocumentComponent) {
|
|
270
|
-
this.requestDocumentComponent.saveRequestDocument();
|
|
271
|
-
this.onRequestFormValidationChange();
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/** Request success handler */
|
|
276
|
-
onRequestDocumentSuccess(): void {
|
|
277
|
-
this.documentHelperService.refreshAllDataWithCurrentFilters(this.contextId);
|
|
278
|
-
if (this.requestSidebarComponent) {
|
|
279
|
-
this.requestSidebarComponent.showSuccess();
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/** Request error handler */
|
|
284
|
-
onRequestDocumentError(error: any): void {
|
|
285
|
-
if (this.requestSidebarComponent) {
|
|
286
|
-
const errorMessage = error?.message || SHARED.UPLOAD_FAILED;
|
|
287
|
-
this.requestSidebarComponent.showError(errorMessage);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/** Handle unsaved changes state from request form */
|
|
292
|
-
onRequestUnsavedChange(hasChanges: boolean): void {
|
|
293
|
-
this.requestHasUnsavedChanges = hasChanges;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Handles the document upload save event
|
|
298
|
-
*/
|
|
299
|
-
onDocumentUploadSave(): void {
|
|
300
|
-
if (this.documentUploadComponent) {
|
|
301
|
-
this.documentUploadComponent.saveDocumentUpload();
|
|
302
|
-
this.updateSaveButtonState();
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* Handles successful document upload and refreshes data
|
|
308
|
-
*/
|
|
309
|
-
onDocumentUploadSuccess(): void {
|
|
310
|
-
this.documentHelperService.refreshAllDataWithCurrentFilters(this.contextId);
|
|
311
|
-
this.hasUnsavedChanges = false; // Reset after successful upload
|
|
312
|
-
if (this.uploadSidebarComponent) {
|
|
313
|
-
this.uploadSidebarComponent.showSuccess();
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Handles document upload error
|
|
319
|
-
*/
|
|
320
|
-
onDocumentUploadError(error: any): void {
|
|
321
|
-
if (this.uploadSidebarComponent) {
|
|
322
|
-
const errorMessage = error?.message || SHARED.UPLOAD_FAILED;
|
|
323
|
-
this.uploadSidebarComponent.showError(errorMessage);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<div class="summary-card mb-4 pb-1">
|
|
2
|
-
<div class="card p-0 mb-0"
|
|
3
|
-
style="border-bottom: 1px solid;border-color: rgba(68, 72, 109, 0.2); border-bottom-right-radius: 0px;border-bottom-left-radius: 0px; background-color: #F9fafb;">
|
|
4
|
-
<div class="p-0">
|
|
5
|
-
<h4 class="m-0 pt-3 pl-3 mb-3" style="font-size: 21px; font-weight: bold; ">Linked Documents</h4>
|
|
6
|
-
</div>
|
|
7
|
-
</div>
|
|
8
|
-
<div class="card mb-0" style="border-top-right-radius: 0px;border-top-left-radius: 0px;">
|
|
9
|
-
@for(document of documentList; track document){
|
|
10
|
-
<div class="linkedDocument documentName m-2">
|
|
11
|
-
<div class="documentName" [class.selected]="document._id === selectedDocument?._id"
|
|
12
|
-
(click)="handleDocumentClick(document)">
|
|
13
|
-
<span class="pi pi-link"></span>
|
|
14
|
-
{{document.fileName}}
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
</div>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
</div>
|
|
23
|
-
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { LinkedDocumentComponent } from './linked-document.component';
|
|
3
|
-
import { DocumentModel } from '../../models/document.model';
|
|
4
|
-
import { Component, Input } from '@angular/core';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* A mock child component used for testing the LinkedDocumentComponent.
|
|
8
|
-
* It mimics a real child component that receives document-related inputs.
|
|
9
|
-
*/
|
|
10
|
-
@Component({
|
|
11
|
-
selector: 'app-mock-child',
|
|
12
|
-
template: ''
|
|
13
|
-
})
|
|
14
|
-
class MockChildComponent {
|
|
15
|
-
/**
|
|
16
|
-
* Represents the currently selected document.
|
|
17
|
-
*/
|
|
18
|
-
@Input() selectedDocument?: DocumentModel;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* A list of available documents.
|
|
22
|
-
*/
|
|
23
|
-
@Input() documentList?: DocumentModel[];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
describe('LinkedDocumentComponent', () => {
|
|
27
|
-
let component: LinkedDocumentComponent;
|
|
28
|
-
let fixture: ComponentFixture<LinkedDocumentComponent>;
|
|
29
|
-
|
|
30
|
-
beforeEach(async () => {
|
|
31
|
-
await TestBed.configureTestingModule({
|
|
32
|
-
declarations: [LinkedDocumentComponent],
|
|
33
|
-
}).compileComponents();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
beforeEach(() => {
|
|
37
|
-
fixture = TestBed.createComponent(LinkedDocumentComponent);
|
|
38
|
-
component = fixture.componentInstance;
|
|
39
|
-
fixture.detectChanges();
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Ensures that the component is created successfully.
|
|
44
|
-
*/
|
|
45
|
-
it('should create', () => {
|
|
46
|
-
expect(component).toBeTruthy();
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Tests whether the `handleDocumentClick` method correctly emits
|
|
51
|
-
* the `selectedDocumentChange` event with the expected document data.
|
|
52
|
-
*/
|
|
53
|
-
it('should emit selectedDocumentChange event when handleDocumentClick is called', () => {
|
|
54
|
-
spyOn(component.selectedDocumentChange, 'emit');
|
|
55
|
-
const document: DocumentModel = { _id: '1', fileName: 'Doc1' };
|
|
56
|
-
|
|
57
|
-
component.handleDocumentClick(document);
|
|
58
|
-
|
|
59
|
-
expect(component.selectedDocumentChange.emit).toHaveBeenCalledWith(document);
|
|
60
|
-
});
|
|
61
|
-
});
|