mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
pre angular 15 cleanup (#8961)
* pre angular 15 cleanup * [ci:force] update test * [ci:force] various updates as per migration * [ci:force] port more changes * [ci:force] migrate tests * [ci:force] migrate formatting * migrate changes * rollback storybook
This commit is contained in:
@@ -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",
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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));
|
||||
});
|
||||
|
||||
|
@@ -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<any> {
|
||||
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<any> {
|
||||
let response = of();
|
||||
let response: any = EMPTY;
|
||||
if (taskId && userId) {
|
||||
response = this.taskService.assignTaskByUserId(taskId, userId);
|
||||
}
|
||||
|
@@ -67,6 +67,7 @@ describe('TaskDetailsComponent', () => {
|
||||
let component: TaskDetailsComponent;
|
||||
let fixture: ComponentFixture<TaskDetailsComponent>;
|
||||
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();
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user