diff --git a/lib/cli/.eslintrc.json b/lib/cli/.eslintrc.json index 4da9581335d..d8d4e2cd05c 100644 --- a/lib/cli/.eslintrc.json +++ b/lib/cli/.eslintrc.json @@ -4,10 +4,7 @@ "overrides": [ { "files": ["*.ts"], - "extends": [ - "plugin:@nrwl/nx/angular", - "plugin:@angular-eslint/template/process-inline-templates" - ], + "extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"], "rules": { "prefer-arrow/prefer-arrow-functions": "off", "@typescript-eslint/no-var-requires": "off", @@ -41,8 +38,7 @@ { "files": ["*.html"], "extends": ["plugin:@nrwl/nx/angular-template"], - "rules": { - } + "rules": {} } ] } diff --git a/lib/content-services/.eslintrc.json b/lib/content-services/.eslintrc.json index ca1efb69bf3..77aa1ad8f13 100644 --- a/lib/content-services/.eslintrc.json +++ b/lib/content-services/.eslintrc.json @@ -4,10 +4,7 @@ "overrides": [ { "files": ["*.ts"], - "extends": [ - "plugin:@nrwl/nx/angular", - "plugin:@angular-eslint/template/process-inline-templates" - ], + "extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"], "rules": { "jsdoc/newline-after-description": "warn", "@typescript-eslint/naming-convention": "warn", @@ -27,24 +24,15 @@ "error", { "type": "element", - "prefix": [ - "adf", - "app" - ], + "prefix": ["adf", "app"], "style": "kebab-case" } ], "@angular-eslint/directive-selector": [ "error", { - "type": [ - "element", - "attribute" - ], - "prefix": [ - "adf", - "app" - ], + "type": ["element", "attribute"], + "prefix": ["adf", "app"], "style": "kebab-case" } ], diff --git a/lib/content-services/.storybook/main.js b/lib/content-services/.storybook/main.js index 04ee5c38d24..dfbcb477ba6 100644 --- a/lib/content-services/.storybook/main.js +++ b/lib/content-services/.storybook/main.js @@ -1,15 +1,9 @@ const rootMain = require('../../../.storybook/main'); module.exports = { - ...rootMain, - core: { ...rootMain.core, builder: 'webpack5' }, - stories: [ - ...rootMain.stories, - '../**/*.stories.@(js|jsx|ts|tsx)' - ], - staticDirs: [ - ...rootMain.staticDirs, - { from: __dirname + '/../src/lib/i18n', to: 'assets/adf-content-services/i18n' } - ], - addons: [...rootMain.addons ] + ...rootMain, + core: { ...rootMain.core, builder: 'webpack5' }, + stories: [...rootMain.stories, '../**/*.stories.@(js|jsx|ts|tsx)'], + staticDirs: [...rootMain.staticDirs, { from: __dirname + '/../src/lib/i18n', to: 'assets/adf-content-services/i18n' }], + addons: [...rootMain.addons] }; diff --git a/lib/content-services/src/lib/category/categories-management/categories-management.component.spec.ts b/lib/content-services/src/lib/category/categories-management/categories-management.component.spec.ts index ffd4281be0a..d7e3801e14f 100644 --- a/lib/content-services/src/lib/category/categories-management/categories-management.component.spec.ts +++ b/lib/content-services/src/lib/category/categories-management/categories-management.component.spec.ts @@ -504,12 +504,16 @@ describe('CategoriesManagementComponent', () => { describe('Errors', () => { it('should display validation error when searching for empty category', fakeAsync(() => { typeCategory(' '); + component.categoryNameControl.markAsTouched(); + fixture.detectChanges(); expect(getFirstError()).toBe('CATEGORIES_MANAGEMENT.ERRORS.EMPTY_CATEGORY'); })); it('should show error for required', fakeAsync(() => { typeCategory(''); + component.categoryNameControl.markAsTouched(); + fixture.detectChanges(); expect(getFirstError()).toBe('CATEGORIES_MANAGEMENT.ERRORS.REQUIRED'); })); @@ -534,6 +538,7 @@ describe('CategoriesManagementComponent', () => { it('should show error for required when not typed anything and blur input', fakeAsync(() => { typeCategory(''); getCategoryControlInput().blur(); + component.categoryNameControl.markAsTouched(); fixture.detectChanges(); expect(getFirstError()).toBe('CATEGORIES_MANAGEMENT.ERRORS.REQUIRED'); diff --git a/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.ts b/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.ts index 02acf913e90..56ee464bf9e 100644 --- a/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.ts +++ b/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.ts @@ -116,7 +116,7 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy { displayCategories = false; private _assignedTags: string[] = []; - private assignedTagsEntries: TagEntry[]; + private assignedTagsEntries: TagEntry[] = []; private _editable = false; private _tagsCreatorMode = TagsCreatorMode.CREATE_AND_ASSIGN; private _tags: string[] = []; @@ -318,7 +318,7 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy { this._saving = false; return of(null); })) - .subscribe((result) => { + .subscribe((result: any) => { if (result) { this.updateUndefinedNodeProperties(result.updatedNode); if (this.hasContentTypeChanged(this.changedProperties)) { diff --git a/lib/content-services/src/lib/content-metadata/services/property-descriptors.service.spec.ts b/lib/content-services/src/lib/content-metadata/services/property-descriptors.service.spec.ts index f50c8cfaf98..0f9034318c3 100644 --- a/lib/content-services/src/lib/content-metadata/services/property-descriptors.service.spec.ts +++ b/lib/content-services/src/lib/content-metadata/services/property-descriptors.service.spec.ts @@ -80,7 +80,7 @@ describe('PropertyDescriptorLoaderService', () => { expect(data['exif:exif']).toBe(exifResponse); expect(data['cm:content']).toBe(contentResponse); }, - complete: done + complete: () => done() }); }); }); diff --git a/lib/content-services/src/lib/content-node-selector/content-node-selector.component.spec.ts b/lib/content-services/src/lib/content-node-selector/content-node-selector.component.spec.ts index 7a4222afeb0..96800a19920 100644 --- a/lib/content-services/src/lib/content-node-selector/content-node-selector.component.spec.ts +++ b/lib/content-services/src/lib/content-node-selector/content-node-selector.component.spec.ts @@ -296,7 +296,7 @@ describe('ContentNodeSelectorComponent', () => { const adfUploadButton = fixture.debugElement.query(By.css('adf-upload-button')); expect(adfUploadButton).not.toBeNull(); - expect(adfUploadButton.nativeElement.innerText).toEqual('file_uploadFORM.FIELD.UPLOAD'); + expect(adfUploadButton.nativeElement.textContent).toEqual('file_uploadFORM.FIELD.UPLOAD'); }); it('should be able to disable UploadButton if showingSearch set to true', () => { diff --git a/lib/content-services/src/lib/content-node-share/content-node-share.dialog.html b/lib/content-services/src/lib/content-node-share/content-node-share.dialog.html index 84227369425..3e20f17dd63 100644 --- a/lib/content-services/src/lib/content-node-share/content-node-share.dialog.html +++ b/lib/content-services/src/lib/content-node-share/content-node-share.dialog.html @@ -31,7 +31,7 @@ [style.display]="isExpiryDateToggleChecked ? 'block' : 'none'" data-automation-id="adf-slide-toggle-checked" class="adf-share-link__date-time-container"> - + {{ 'SHARE.EXPIRATION-PLACEHOLDER' | translate }} { - return isBefore(endOfDay(new Date(control.value)), this.minDate) ? {invalidDate: true} : null; - }; + private minDateValidator = (control: AbstractControl): any => + isBefore(endOfDay(new Date(control.value)), this.minDate) ? { invalidDate: true } : null; minDate = add(new Date(), { days: 1 }); sharedId: string; @@ -55,9 +48,9 @@ export class ShareDialogComponent implements OnInit, OnDestroy { isFileShared = false; isDisabled = false; isLinkWithExpiryDate = false; - form: UntypedFormGroup = new UntypedFormGroup({ - sharedUrl: new UntypedFormControl(''), - time: new UntypedFormControl({value: '', disabled: true}, [Validators.required, this.minDateValidator]) + form: FormGroup = new FormGroup({ + sharedUrl: new FormControl(''), + time: new FormControl({ value: '', disabled: true }, [Validators.required, this.minDateValidator]) }); type: DatePickerType = 'date'; maxDebounceTime = 500; diff --git a/lib/content-services/src/lib/dialogs/confirm.dialog.spec.ts b/lib/content-services/src/lib/dialogs/confirm.dialog.spec.ts index aa697471957..a52bf92f85e 100644 --- a/lib/content-services/src/lib/dialogs/confirm.dialog.spec.ts +++ b/lib/content-services/src/lib/dialogs/confirm.dialog.spec.ts @@ -161,7 +161,7 @@ describe('Confirm Dialog Component', () => { By.css('[data-automation-id="adf-confirm-dialog-confirm-all"]') ); expect(thirdOptionElement).not.toBeNull(); - expect(thirdOptionElement.nativeElement.innerText).toBe('YES ALL'); + expect(thirdOptionElement.nativeElement.innerText.toUpperCase()).toBe('YES ALL'); }); }); }); diff --git a/lib/content-services/src/lib/document-list/components/document-list.component.spec.ts b/lib/content-services/src/lib/document-list/components/document-list.component.spec.ts index 19c82bf1295..6afad064061 100644 --- a/lib/content-services/src/lib/document-list/components/document-list.component.spec.ts +++ b/lib/content-services/src/lib/document-list/components/document-list.component.spec.ts @@ -341,7 +341,7 @@ describe('DocumentList', () => { documentList.executeContentAction(node, action); expect(action.execute).not.toHaveBeenCalled(); - deleteObservable.next(); + deleteObservable.next(undefined); expect(action.execute).toHaveBeenCalledWith(node); }); diff --git a/lib/content-services/src/lib/material.module.ts b/lib/content-services/src/lib/material.module.ts index e7145cef5aa..f266aac1885 100644 --- a/lib/content-services/src/lib/material.module.ts +++ b/lib/content-services/src/lib/material.module.ts @@ -21,7 +21,7 @@ import { MatCardModule } from '@angular/material/card'; import { MatCheckboxModule } from '@angular/material/checkbox'; import { MatAutocompleteModule } from '@angular/material/autocomplete'; import { MatChipsModule } from '@angular/material/chips'; -import { MatOptionModule, MatRippleModule } from '@angular/material/core'; +import { MatRippleModule, MatOptionModule } from '@angular/material/core'; import { MatDatepickerModule } from '@angular/material/datepicker'; import { MatDialogModule } from '@angular/material/dialog'; import { MatExpansionModule } from '@angular/material/expansion'; diff --git a/lib/content-services/src/lib/permission-manager/components/add-permission/add-permission-dialog.component.spec.ts b/lib/content-services/src/lib/permission-manager/components/add-permission/add-permission-dialog.component.spec.ts index 7e1525055b1..23d32127855 100644 --- a/lib/content-services/src/lib/permission-manager/components/add-permission/add-permission-dialog.component.spec.ts +++ b/lib/content-services/src/lib/permission-manager/components/add-permission/add-permission-dialog.component.spec.ts @@ -83,7 +83,7 @@ describe('AddPermissionDialog', () => { it('should show the INJECTED title', () => { const titleElement = fixture.debugElement.query(By.css('#add-permission-dialog-title')); expect(titleElement).not.toBeNull(); - expect(titleElement.nativeElement.innerText).toBe('dead or alive you are coming with me'); + expect(titleElement.nativeElement.innerText.trim()).toBe('dead or alive you are coming with me'); }); it('should close the dialog when close button is clicked', () => { @@ -128,7 +128,7 @@ describe('AddPermissionDialog', () => { await fixture.whenStable(); const selectBox = fixture.debugElement.query(By.css(('[id="adf-select-role-permission"] .mat-select-trigger'))); - selectBox.triggerEventHandler('click', null); + selectBox.nativeElement.dispatchEvent(new Event('click')); fixture.detectChanges(); const options = fixture.debugElement.queryAll(By.css('mat-option')); @@ -171,7 +171,7 @@ describe('AddPermissionDialog', () => { await fixture.whenStable(); const selectBox = fixture.debugElement.query(By.css(('[id="adf-bulk-select-role-permission"] .mat-select-trigger'))); - selectBox.triggerEventHandler('click', null); + selectBox.nativeElement.dispatchEvent(new Event('click')); fixture.detectChanges(); await fixture.whenStable(); @@ -213,7 +213,7 @@ describe('AddPermissionDialog', () => { await fixture.whenStable(); const selectBox = fixture.debugElement.query(By.css(('[id="adf-select-role-permission"] .mat-select-trigger'))); - selectBox.triggerEventHandler('click', null); + selectBox.nativeElement.dispatchEvent(new Event('click')); fixture.detectChanges(); await fixture.whenStable(); diff --git a/lib/content-services/src/lib/permission-manager/components/add-permission/add-permission-panel.component.html b/lib/content-services/src/lib/permission-manager/components/add-permission/add-permission-panel.component.html index 7bfaa04f377..cd4d5ebde54 100644 --- a/lib/content-services/src/lib/permission-manager/components/add-permission/add-permission-panel.component.html +++ b/lib/content-services/src/lib/permission-manager/components/add-permission/add-permission-panel.component.html @@ -41,7 +41,7 @@

@@ -50,7 +50,7 @@ = of(null); const nodeBody = { permissions: { isInheritanceEnabled: !this.node.permissions.isInheritanceEnabled diff --git a/lib/content-services/src/lib/permission-manager/components/pop-over.directive.ts b/lib/content-services/src/lib/permission-manager/components/pop-over.directive.ts index 87d8748516b..89c42761673 100644 --- a/lib/content-services/src/lib/permission-manager/components/pop-over.directive.ts +++ b/lib/content-services/src/lib/permission-manager/components/pop-over.directive.ts @@ -72,7 +72,7 @@ export class PopOverDirective implements OnInit, OnDestroy, AfterViewInit { ngOnDestroy(): void { this.element.nativeElement.removeEventListener('keydown', this.preventDefaultForEnter); this.detachOverlay(); - this.destroy$.next(); + this.destroy$.next(undefined); this.destroy$.complete(); } diff --git a/lib/content-services/src/lib/search/services/search-facet-filters.service.ts b/lib/content-services/src/lib/search/services/search-facet-filters.service.ts index 271894379f6..62c3cb0ef6c 100644 --- a/lib/content-services/src/lib/search/services/search-facet-filters.service.ts +++ b/lib/content-services/src/lib/search/services/search-facet-filters.service.ts @@ -422,7 +422,7 @@ export class SearchFacetFiltersService implements OnDestroy { } ngOnDestroy(): void { - this.onDestroy$.next(); + this.onDestroy$.next(undefined); this.onDestroy$.complete(); } diff --git a/lib/content-services/src/lib/tag/services/tag.service.spec.ts b/lib/content-services/src/lib/tag/services/tag.service.spec.ts index be1f2a80560..60de5ec8576 100644 --- a/lib/content-services/src/lib/tag/services/tag.service.spec.ts +++ b/lib/content-services/src/lib/tag/services/tag.service.spec.ts @@ -90,7 +90,7 @@ describe('TagService', () => { }); describe('createTags', () => { - it('should call createTags on tagsApi', () => { + it('should call createTags on tagsApi', (done) => { spyOn(service.tagsApi, 'createTags').and.returnValue(Promise.resolve([])); const tag1 = new TagBody(); tag1.tag = 'Some tag 1'; @@ -98,7 +98,9 @@ describe('TagService', () => { tag2.tag = 'Some tag 2'; const tags = [tag1, tag2]; service.createTags(tags); + expect(service.tagsApi.createTags).toHaveBeenCalledWith(tags); + done(); }); it('should emit refresh when tags creation is success', fakeAsync(() => { diff --git a/lib/content-services/src/lib/tag/tags-creator/tags-creator.component.spec.ts b/lib/content-services/src/lib/tag/tags-creator/tags-creator.component.spec.ts index 407a2fa7f1b..f9629b2197b 100644 --- a/lib/content-services/src/lib/tag/tags-creator/tags-creator.component.spec.ts +++ b/lib/content-services/src/lib/tag/tags-creator/tags-creator.component.spec.ts @@ -381,12 +381,15 @@ describe('TagsCreatorComponent', () => { it('should show error for only spaces', fakeAsync(() => { typeTag(' '); + component.tagNameControl.markAsTouched(); + fixture.detectChanges(); const error = getFirstError(); expect(error).toBe('TAG.TAGS_CREATOR.ERRORS.EMPTY_TAG'); })); it('should show error for only spaces if tags are changed', fakeAsync(() => { typeTag(' '); + component.tagNameControl.markAsTouched(); component.tags = ['new tag 1', 'new tag 2']; fixture.detectChanges(); expect(getFirstError()).toBe('TAG.TAGS_CREATOR.ERRORS.EMPTY_TAG'); @@ -394,12 +397,15 @@ describe('TagsCreatorComponent', () => { it('should show error for required', fakeAsync(() => { typeTag(''); + component.tagNameControl.markAsTouched(); + fixture.detectChanges(); const error = getFirstError(); expect(error).toBe('TAG.TAGS_CREATOR.ERRORS.REQUIRED'); })); it('should not show error for required if tags are changed', fakeAsync(() => { typeTag(''); + component.tagNameControl.markAsTouched(); component.tags = ['new tag 1', 'new tag 2']; fixture.detectChanges(); expect(getFirstError()).toBeUndefined(); @@ -443,10 +449,7 @@ describe('TagsCreatorComponent', () => { it('should error for required when not typed anything and blur input', fakeAsync(() => { component.tagNameControlVisible = true; - fixture.detectChanges(); - tick(100); - - getNameInput().blur(); + component.tagNameControl.markAsTouched(); fixture.detectChanges(); const error = getFirstError(); @@ -600,6 +603,8 @@ describe('TagsCreatorComponent', () => { ); typeTag('Tag'); + component.tagNameControl.markAsTouched(); + fixture.detectChanges(); const tagElements = getExistingTags(); expect(tagElements).toEqual([tag1, tag2]); @@ -782,6 +787,8 @@ describe('TagsCreatorComponent', () => { it('should be displayed when existing tags are loading', fakeAsync(() => { typeTag('tag', 0); + component.tagNameControl.markAsTouched(); + fixture.detectChanges(); const spinner = getSpinner(); expect(spinner).toBeTruthy(); diff --git a/lib/content-services/src/lib/upload/components/file-uploading-dialog.component.ts b/lib/content-services/src/lib/upload/components/file-uploading-dialog.component.ts index c933b876558..efa01f9d857 100644 --- a/lib/content-services/src/lib/upload/components/file-uploading-dialog.component.ts +++ b/lib/content-services/src/lib/upload/components/file-uploading-dialog.component.ts @@ -104,9 +104,9 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy { if (this.filesUploadingList.length && !this.isDialogActive) { this.isDialogActive = true; - this.dialogActive.next(); + this.dialogActive.next(undefined); } else { - this.dialogActive.next(); + this.dialogActive.next(undefined); } }); @@ -159,7 +159,7 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy { this.isConfirmation = !this.isConfirmation; if (!this.isConfirmation) { - this.dialogActive.next(); + this.dialogActive.next(undefined); } if (this.isDialogMinimized) { @@ -172,7 +172,7 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy { */ cancelAllUploads() { this.toggleConfirmation(); - this.dialogActive.next(); + this.dialogActive.next(undefined); this.uploadList.cancelAllFiles(); } diff --git a/lib/content-services/src/lib/version-compatibility/version-compatibility.service.ts b/lib/content-services/src/lib/version-compatibility/version-compatibility.service.ts index 54d7a74feec..aecdd336f05 100644 --- a/lib/content-services/src/lib/version-compatibility/version-compatibility.service.ts +++ b/lib/content-services/src/lib/version-compatibility/version-compatibility.service.ts @@ -27,7 +27,7 @@ import { DiscoveryApiService } from '../common/services/discovery-api.service'; export class VersionCompatibilityService { private acsVersion: VersionInfo; - acsVersionInitialized$ = new ReplaySubject(); + acsVersionInitialized$ = new ReplaySubject(); constructor(private discoveryApiService: DiscoveryApiService) { this.discoveryApiService.ecmProductInfo$ @@ -37,7 +37,7 @@ export class VersionCompatibilityService { private initializeAcsVersion(acsVersion: VersionInfo) { this.acsVersion = acsVersion; - this.acsVersionInitialized$.next(); + this.acsVersionInitialized$.next(undefined); } getAcsVersion(): VersionInfo { diff --git a/lib/content-services/src/lib/version-manager/version-upload.component.spec.ts b/lib/content-services/src/lib/version-manager/version-upload.component.spec.ts index 51232eba62d..edf83c2c61f 100644 --- a/lib/content-services/src/lib/version-manager/version-upload.component.spec.ts +++ b/lib/content-services/src/lib/version-manager/version-upload.component.spec.ts @@ -75,7 +75,7 @@ describe('VersionUploadComponent', () => { expect(component.disabled).toEqual(true); }); - uploadService.fileUploadStarting.next(); + uploadService.fileUploadStarting.next(undefined); }); it('should enable upload button on error', () => { diff --git a/lib/content-services/src/lib/version-manager/version-upload.component.ts b/lib/content-services/src/lib/version-manager/version-upload.component.ts index c7ec3962f03..c236967bc3d 100644 --- a/lib/content-services/src/lib/version-manager/version-upload.component.ts +++ b/lib/content-services/src/lib/version-manager/version-upload.component.ts @@ -36,7 +36,7 @@ export class VersionUploadComponent implements OnInit, OnDestroy { comment: string; uploadVersion: boolean = false; disabled: boolean = false; - onDestroy$ = new Subject(); + onDestroy$ = new Subject(); majorVersion = '2.0'; minorVersion = '1.1'; @@ -133,7 +133,7 @@ export class VersionUploadComponent implements OnInit, OnDestroy { } ngOnDestroy() { - this.onDestroy$.next(); + this.onDestroy$.next(undefined); this.onDestroy$.complete(); } diff --git a/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.ts b/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.ts index 11942cee32e..ca168c66076 100644 --- a/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.ts +++ b/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.ts @@ -170,7 +170,7 @@ export class AlfrescoViewerComponent implements OnChanges, OnInit, OnDestroy { /** Emitted when the shared link used is not valid. */ @Output() - invalidSharedLink = new EventEmitter(); + invalidSharedLink = new EventEmitter(); /** Emitted when user clicks 'Navigate Before' ("<") button. */ @Output() @@ -272,7 +272,7 @@ export class AlfrescoViewerComponent implements OnChanges, OnInit, OnDestroy { await this.setUpSharedLinkFile(sharedLinkEntry); } catch (error) { this.logService.error('This sharedLink does not exist'); - this.invalidSharedLink.next(); + this.invalidSharedLink.next(undefined); this.mimeType = 'invalid-link'; this.urlFileContent = 'invalid-file'; } diff --git a/lib/core/.eslintrc.json b/lib/core/.eslintrc.json index 1e4f82bb631..8b7a510ed7a 100644 --- a/lib/core/.eslintrc.json +++ b/lib/core/.eslintrc.json @@ -4,10 +4,7 @@ "overrides": [ { "files": ["*.ts"], - "extends": [ - "plugin:@nrwl/nx/angular", - "plugin:@angular-eslint/template/process-inline-templates" - ], + "extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"], "rules": { "jsdoc/newline-after-description": "warn", "@typescript-eslint/naming-convention": "off", @@ -28,24 +25,15 @@ "error", { "type": "element", - "prefix": [ - "adf", - "app" - ], + "prefix": ["adf", "app"], "style": "kebab-case" } ], "@angular-eslint/directive-selector": [ "error", { - "type": [ - "element", - "attribute" - ], - "prefix": [ - "adf", - "app" - ], + "type": ["element", "attribute"], + "prefix": ["adf", "app"], "style": "kebab-case" } ], diff --git a/lib/core/src/lib/auth/oidc/oidc-authentication.service.ts b/lib/core/src/lib/auth/oidc/oidc-authentication.service.ts index 5290e6a3569..0b0ceddc627 100644 --- a/lib/core/src/lib/auth/oidc/oidc-authentication.service.ts +++ b/lib/core/src/lib/auth/oidc/oidc-authentication.service.ts @@ -42,7 +42,7 @@ export class OIDCAuthenticationService extends BaseAuthenticationService { this.oauthService.events.pipe( filter((event)=> event.type === 'token_received') ).subscribe(()=>{ - this.onLogin.next(); + this.onLogin.next({}); }); }); } diff --git a/lib/core/src/lib/search-text/search-text-input.component.ts b/lib/core/src/lib/search-text/search-text-input.component.ts index b21f0494f30..547223e83a0 100644 --- a/lib/core/src/lib/search-text/search-text-input.component.ts +++ b/lib/core/src/lib/search-text/search-text-input.component.ts @@ -264,7 +264,7 @@ export class SearchTextInputComponent implements OnInit, OnDestroy { toggleSearchBar() { if (this.toggleSearch) { - this.toggleSearch.next(); + this.toggleSearch.next({}); } } diff --git a/lib/core/src/lib/viewer/components/pdf-viewer.component.ts b/lib/core/src/lib/viewer/components/pdf-viewer.component.ts index 0a267a31309..63893ac3f98 100644 --- a/lib/core/src/lib/viewer/components/pdf-viewer.component.ts +++ b/lib/core/src/lib/viewer/components/pdf-viewer.component.ts @@ -254,9 +254,9 @@ export class PdfViewerComponent implements OnChanges, OnDestroy { } if (this.loadingTask) { - this.pdfjsWorkerDestroy$.next(); + this.pdfjsWorkerDestroy$.next(true); } - this.onDestroy$.next(); + this.onDestroy$.next(true); this.pdfjsWorkerDestroy$.complete(); this.onDestroy$.complete(); } diff --git a/lib/extensions/.eslintrc.json b/lib/extensions/.eslintrc.json index ee426f6a164..11e989a37fc 100644 --- a/lib/extensions/.eslintrc.json +++ b/lib/extensions/.eslintrc.json @@ -4,10 +4,7 @@ "overrides": [ { "files": ["*.ts"], - "extends": [ - "plugin:@nrwl/nx/angular", - "plugin:@angular-eslint/template/process-inline-templates" - ], + "extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"], "rules": { "no-underscore-dangle": ["error", { "allowAfterThis": true }], @@ -15,24 +12,15 @@ "error", { "type": "element", - "prefix": [ - "adf", - "app" - ], + "prefix": ["adf", "app"], "style": "kebab-case" } ], "@angular-eslint/directive-selector": [ "error", { - "type": [ - "element", - "attribute" - ], - "prefix": [ - "adf", - "app" - ], + "type": ["element", "attribute"], + "prefix": ["adf", "app"], "style": "kebab-case" } ], diff --git a/lib/process-services-cloud/src/lib/task/services/task-cloud.service.ts b/lib/process-services-cloud/src/lib/task/services/task-cloud.service.ts index 43a2e841709..0a1ca96f6ec 100644 --- a/lib/process-services-cloud/src/lib/task/services/task-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/task/services/task-cloud.service.ts @@ -138,7 +138,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi return this.post(queryUrl).pipe( map((res: any) => { - this.dataChangesDetected$.next(); + this.dataChangesDetected$.next(res); return res.entry; }) ); @@ -161,7 +161,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi return this.post(queryUrl).pipe( map((res: any) => { - this.dataChangesDetected$.next(); + this.dataChangesDetected$.next(res); return res.entry; }) ); diff --git a/lib/process-services/.eslintrc.json b/lib/process-services/.eslintrc.json index d586f738bcd..98e729ec9a6 100644 --- a/lib/process-services/.eslintrc.json +++ b/lib/process-services/.eslintrc.json @@ -4,10 +4,7 @@ "overrides": [ { "files": ["*.ts"], - "extends": [ - "plugin:@nrwl/nx/angular", - "plugin:@angular-eslint/template/process-inline-templates" - ], + "extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"], "rules": { "jsdoc/newline-after-description": "warn", "@typescript-eslint/naming-convention": "warn", diff --git a/lib/process-services/src/lib/form/widgets/upload/upload.widget.spec.ts b/lib/process-services/src/lib/form/widgets/upload/upload.widget.spec.ts index 971cf54eadd..cfd6da6dc4e 100644 --- a/lib/process-services/src/lib/form/widgets/upload/upload.widget.spec.ts +++ b/lib/process-services/src/lib/form/widgets/upload/upload.widget.spec.ts @@ -45,10 +45,10 @@ const fakePngAnswer = new RelatedContentRepresentation({ thumbnailStatus: 'queued' }); -const fakeJpgAnswer = { +const fakeJpgAnswer = new RelatedContentRepresentation({ id: 1156, name: 'a_jpg_file.jpg', - created: '2017-07-25T17:17:37.118Z', + created: new Date('2017-07-25T17:17:37.118Z'), createdBy: {id: 1001, firstName: 'Admin', lastName: 'admin', email: 'admin'}, relatedContent: false, contentAvailable: true, @@ -57,7 +57,7 @@ const fakeJpgAnswer = { simpleType: 'image', previewStatus: 'queued', thumbnailStatus: 'queued' -}; +}); describe('UploadWidgetComponent', () => { @@ -191,7 +191,7 @@ describe('UploadWidgetComponent', () => { }); it('should show the list file after upload a new content', async () => { - spyOn(contentService, 'createTemporaryRawRelatedContent').and.returnValue(of(fakePngAnswer)); + spyOn(contentService, 'createTemporaryRawRelatedContent').and.returnValues(of(fakePngAnswer), of(fakeJpgAnswer)); uploadWidgetComponent.field.params.multiple = false; @@ -207,17 +207,7 @@ describe('UploadWidgetComponent', () => { }); it('should update the form after deleted a file', async () => { - spyOn(contentService, 'createTemporaryRawRelatedContent').and.callFake((file: any) => { - if (file.name === 'file-fake.png') { - return of(fakePngAnswer); - } - - if (file.name === 'file-fake.jpg') { - return of(fakeJpgAnswer); - } - - return of(null); - }); + spyOn(contentService, 'createTemporaryRawRelatedContent').and.returnValues(of(fakePngAnswer), of(fakeJpgAnswer)); uploadWidgetComponent.field.params.multiple = true; diff --git a/lib/process-services/src/lib/process-list/components/process-instance-details.component.spec.ts b/lib/process-services/src/lib/process-list/components/process-instance-details.component.spec.ts index e152d58be00..96cd3d5c153 100644 --- a/lib/process-services/src/lib/process-list/components/process-instance-details.component.spec.ts +++ b/lib/process-services/src/lib/process-list/components/process-instance-details.component.spec.ts @@ -52,6 +52,7 @@ describe('ProcessInstanceDetailsComponent', () => { const commentService = fixture.debugElement.injector.get(CommentProcessService); getProcessSpy = spyOn(service, 'getProcess').and.returnValue(of(exampleProcess)); + spyOn(service, 'getProcessTasks').and.returnValue(of()); spyOn(commentService, 'get').and.returnValue(of(mockProcessInstanceComments)); }); diff --git a/lib/process-services/src/lib/task-list/components/start-task.component.ts b/lib/process-services/src/lib/task-list/components/start-task.component.ts index 24a6afda845..0a8e8b66123 100644 --- a/lib/process-services/src/lib/task-list/components/start-task.component.ts +++ b/lib/process-services/src/lib/task-list/components/start-task.component.ts @@ -22,7 +22,7 @@ import { import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation, OnDestroy } from '@angular/core'; import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core'; import moment, { Moment } from 'moment'; -import { Observable, of, Subject } from 'rxjs'; +import { EMPTY, Observable, Subject } from 'rxjs'; import { Form } from '../models/form.model'; import { TaskDetailsModel } from '../models/task-details.model'; import { TaskListService } from './../services/tasklist.service'; @@ -226,7 +226,7 @@ export class StartTaskComponent implements OnInit, OnDestroy { } private attachForm(taskId: string, formKey: string): Observable { - let response = of(); + let response: any = EMPTY; if (taskId && formKey) { response = this.taskService.attachFormToATask(taskId, parseInt(formKey, 10)); } @@ -234,7 +234,7 @@ export class StartTaskComponent implements OnInit, OnDestroy { } private assignTaskByUserId(taskId: string, userId: any): Observable { - let response = of(); + let response: any = EMPTY; if (taskId && userId) { response = this.taskService.assignTaskByUserId(taskId, userId); } diff --git a/lib/process-services/src/lib/task-list/components/task-details.component.spec.ts b/lib/process-services/src/lib/task-list/components/task-details.component.spec.ts index 7337eb537c9..8bba0e3a59b 100644 --- a/lib/process-services/src/lib/task-list/components/task-details.component.spec.ts +++ b/lib/process-services/src/lib/task-list/components/task-details.component.spec.ts @@ -67,6 +67,7 @@ describe('TaskDetailsComponent', () => { let component: TaskDetailsComponent; let fixture: ComponentFixture; let getTaskDetailsSpy: jasmine.Spy; + let getCommentsSpy: jasmine.Spy; let getTasksSpy: jasmine.Spy; let assignTaskSpy: jasmine.Spy; let logService: LogService; @@ -101,7 +102,7 @@ describe('TaskDetailsComponent', () => { assignTaskSpy = spyOn(taskListService, 'assignTask').and.returnValue(of(fakeTaskAssignResponse)); taskCommentsService = TestBed.inject(TaskCommentsService); - spyOn(taskCommentsService, 'get').and.returnValue(of([ + getCommentsSpy = spyOn(taskCommentsService, 'get').and.returnValue(of([ new CommentModel({ message: 'Test1', created: new Date(), createdBy: new User({ firstName: 'Admin', lastName: 'User' }) }), new CommentModel({ message: 'Test2', created: new Date(), createdBy: new User({ firstName: 'Admin', lastName: 'User' }) }), new CommentModel({ message: 'Test3', created: new Date(), createdBy: new User({ firstName: 'Admin', lastName: 'User' }) }) @@ -114,6 +115,7 @@ describe('TaskDetailsComponent', () => { afterEach(() => { getTaskDetailsSpy.calls.reset(); + getCommentsSpy.calls.reset(); fixture.destroy(); }); diff --git a/lib/testing/.eslintrc.json b/lib/testing/.eslintrc.json index f84c06a6a07..dfde740176a 100644 --- a/lib/testing/.eslintrc.json +++ b/lib/testing/.eslintrc.json @@ -4,10 +4,7 @@ "overrides": [ { "files": ["*.ts"], - "extends": [ - "plugin:@nrwl/nx/angular", - "plugin:@angular-eslint/template/process-inline-templates" - ], + "extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"], "rules": { "@angular-eslint/component-selector": [ "error", @@ -64,8 +61,7 @@ { "files": ["*.html"], "extends": ["plugin:@nrwl/nx/angular-template"], - "rules": { - } + "rules": {} } ] } diff --git a/tsconfig.json b/tsconfig.json index 5189cb56989..fc7444b5063 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -37,14 +37,7 @@ "@alfresco/js-api": ["node_modules/@alfresco/js-api"] } }, - "exclude": [ - "lib/config", - "integration", - "scripts", - "assets", - "tools", - "node_modules" - ], + "exclude": ["lib/config", "integration", "scripts", "assets", "tools", "node_modules"], "angularCompilerOptions": { "fullTemplateTypeCheck": true, "strictInjectionParameters": true,