mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-5415] remove deprecated async method (#7171)
* remove deprecated async method * fix tests and code * test fixes * fix tests
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { of } from 'rxjs';
|
||||
import { FormService } from '../services/form.service';
|
||||
import { FormListComponent } from './form-list.component';
|
||||
@@ -28,7 +28,7 @@ describe('TaskAttachmentList', () => {
|
||||
let component: FormListComponent;
|
||||
let fixture: ComponentFixture<FormListComponent>;
|
||||
let service: FormService;
|
||||
let element: any;
|
||||
let element: HTMLElement;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
@@ -37,14 +37,12 @@ describe('TaskAttachmentList', () => {
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(async(() => {
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(FormListComponent);
|
||||
component = fixture.componentInstance;
|
||||
element = fixture.debugElement.nativeElement;
|
||||
service = TestBed.inject(FormService);
|
||||
|
||||
}));
|
||||
});
|
||||
|
||||
it('should show the forms as a list', async () => {
|
||||
spyOn(service, 'getForms').and.returnValue(of([
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { ContentService } from '../../../../services';
|
||||
import { of } from 'rxjs';
|
||||
@@ -69,10 +69,10 @@ describe('ContentWidgetComponent', () => {
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(async(() => {
|
||||
beforeEach(() => {
|
||||
serviceContent = TestBed.inject(ContentService);
|
||||
processContentService = TestBed.inject(ProcessContentService);
|
||||
}));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ContentWidgetComponent);
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { FormService } from '../../../services/form.service';
|
||||
@@ -54,14 +54,14 @@ describe('DropdownWidgetComponent', () => {
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(async(() => {
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DropdownWidgetComponent);
|
||||
widget = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
formService = TestBed.inject(FormService);
|
||||
visibilityService = TestBed.inject(WidgetVisibilityService);
|
||||
widget.field = new FormFieldModel(new FormModel());
|
||||
}));
|
||||
});
|
||||
|
||||
it('should require field with restUrl', () => {
|
||||
spyOn(formService, 'getRestFieldValues').and.stub();
|
||||
@@ -125,12 +125,12 @@ describe('DropdownWidgetComponent', () => {
|
||||
|
||||
describe('when is required', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
beforeEach(() => {
|
||||
widget.field = new FormFieldModel( new FormModel({ taskId: '<id>' }), {
|
||||
type: FormFieldTypes.DROPDOWN,
|
||||
required: true
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
it('should be able to display label with asterix', async () => {
|
||||
const label = 'MyLabel123';
|
||||
@@ -165,7 +165,7 @@ describe('DropdownWidgetComponent', () => {
|
||||
|
||||
describe('and dropdown is populated via taskId', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
beforeEach(() => {
|
||||
spyOn(visibilityService, 'refreshVisibility').and.stub();
|
||||
spyOn(formService, 'getRestFieldValues').and.callFake(() => {
|
||||
return of(fakeOptionList);
|
||||
@@ -180,7 +180,7 @@ describe('DropdownWidgetComponent', () => {
|
||||
widget.field.emptyOption = { id: 'empty', name: 'Choose one...' };
|
||||
widget.field.isVisible = true;
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
});
|
||||
|
||||
it('should show visible dropdown widget', async () => {
|
||||
expect(element.querySelector('#dropdown-id')).toBeDefined();
|
||||
@@ -228,7 +228,7 @@ describe('DropdownWidgetComponent', () => {
|
||||
|
||||
describe('and dropdown is populated via processDefinitionId', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
beforeEach(() => {
|
||||
spyOn(visibilityService, 'refreshVisibility').and.stub();
|
||||
spyOn(formService, 'getRestFieldValuesByProcessId').and.callFake(() => {
|
||||
return of(fakeOptionList);
|
||||
@@ -243,7 +243,7 @@ describe('DropdownWidgetComponent', () => {
|
||||
widget.field.emptyOption = { id: 'empty', name: 'Choose one...' };
|
||||
widget.field.isVisible = true;
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
});
|
||||
|
||||
it('should show visible dropdown widget', () => {
|
||||
expect(element.querySelector('#dropdown-id')).toBeDefined();
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { tick, fakeAsync, async, ComponentFixture, TestBed, flush } from '@angular/core/testing';
|
||||
import { tick, fakeAsync, ComponentFixture, TestBed, flush } from '@angular/core/testing';
|
||||
import { fakeFormJson } from '../../../../mock';
|
||||
import { FormFieldModel } from '../core/form-field.model';
|
||||
import { FormModel } from '../core/form.model';
|
||||
@@ -88,7 +88,7 @@ describe('TabsWidgetComponent', () => {
|
||||
let fakeTabVisible: TabModel;
|
||||
let fakeTabInvisible: TabModel;
|
||||
|
||||
beforeEach(async(() => {
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(TabsWidgetComponent);
|
||||
tabWidgetComponent = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
@@ -105,7 +105,7 @@ describe('TabsWidgetComponent', () => {
|
||||
fakeTabInvisible.isVisible = false;
|
||||
tabWidgetComponent.tabs.push(fakeTabVisible);
|
||||
tabWidgetComponent.tabs.push(fakeTabInvisible);
|
||||
}));
|
||||
});
|
||||
|
||||
it('should show only visible tabs', fakeAsync(() => {
|
||||
fixture.detectChanges();
|
||||
|
Reference in New Issue
Block a user