mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
unit test performance (#3194)
* DataTable (-4 sec) * PaginationComponent (-1 sec) * DocumentList * custom testbed setup, test upgrades * test fixes * more test fixes * remove fdescribe * test fixes * test fixes * more test fixes * test fixes * upgrade tests * update tests * upgrade tests * upgrade tests * upgrade tests * upgrade tests * update tests * translate loader fixes * auth and cookie fixes * upgrade tests * upgrade tests * test fixes * almost there * diable broken tests * process tests (part 1) * fix lint issues * another test upgrade * almost there * cleanup * insights testing upgrade * improve tests * tests cleanup * tests cleanup * cleanup tests * test cleanup * favorite nodes tests * rebase fix syntax * fix core test * give up test focus * flush tabs * fix search test * Update document-list.component.spec.ts * fix document list lock * increase tick time * remove duplicate test
This commit is contained in:
committed by
Eugenio Romano
parent
9fbfcfa96e
commit
382ea3c1b3
@@ -15,18 +15,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MaterialModule } from '../../../material.module';
|
||||
import { ErrorWidgetComponent } from '../widgets/error/error.component';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { FormRenderingService } from './../../services/form-rendering.service';
|
||||
import { WidgetVisibilityService } from './../../services/widget-visibility.service';
|
||||
import { FormFieldModel, FormFieldTypes, FormModel } from './../widgets/core/index';
|
||||
import { InputMaskDirective } from './../widgets/text/text-mask.component';
|
||||
import { TextWidgetComponent, CheckboxWidgetComponent, WidgetComponent } from '../widgets/index';
|
||||
import { TextWidgetComponent, CheckboxWidgetComponent } from '../widgets/index';
|
||||
import { FormFieldComponent } from './form-field.component';
|
||||
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
|
||||
import { FormService } from '../../services/form.service';
|
||||
import { EcmModelService } from '../../services/ecm-model.service';
|
||||
import { setupTestBed } from '../../../testing/setupTestBed';
|
||||
import { CoreModule } from '../../../core.module';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
describe('FormFieldComponent', () => {
|
||||
|
||||
@@ -36,35 +32,12 @@ describe('FormFieldComponent', () => {
|
||||
|
||||
let formRenderingService: FormRenderingService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
FormFieldComponent,
|
||||
WidgetComponent,
|
||||
TextWidgetComponent,
|
||||
CheckboxWidgetComponent,
|
||||
InputMaskDirective,
|
||||
ErrorWidgetComponent],
|
||||
providers: [
|
||||
FormRenderingService,
|
||||
WidgetVisibilityService,
|
||||
FormService,
|
||||
EcmModelService
|
||||
]
|
||||
});
|
||||
|
||||
TestBed.overrideModule(BrowserDynamicTestingModule, {
|
||||
set: {
|
||||
entryComponents: [WidgetComponent, TextWidgetComponent, CheckboxWidgetComponent]
|
||||
}
|
||||
});
|
||||
|
||||
TestBed.compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CoreModule.forRoot()
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(FormFieldComponent);
|
||||
|
@@ -16,14 +16,13 @@
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { TranslationService } from '../../index';
|
||||
import { DataTableModule } from '../../datatable/datatable.module';
|
||||
import { DataColumnModule } from '../../data-column/data-column.module';
|
||||
import { TranslationService, TranslationMock } from '../../index';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { EcmModelService } from '../services/ecm-model.service';
|
||||
import { FormService } from '../services/form.service';
|
||||
import { FormListComponent } from './form-list.component';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { setupTestBed } from '../../testing/setupTestBed';
|
||||
import { CoreModule } from '../../core.module';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
describe('TaskAttachmentList', () => {
|
||||
|
||||
@@ -32,28 +31,15 @@ describe('TaskAttachmentList', () => {
|
||||
let service: FormService;
|
||||
let element: any;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataColumnModule,
|
||||
DataTableModule,
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
FormListComponent
|
||||
],
|
||||
providers: [
|
||||
FormService,
|
||||
EcmModelService
|
||||
]
|
||||
}).compileComponents();
|
||||
|
||||
let translateService = TestBed.get(TranslationService);
|
||||
spyOn(translateService, 'addTranslationFolder').and.stub();
|
||||
spyOn(translateService, 'get').and.callFake((key) => {
|
||||
return Observable.of(key);
|
||||
});
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CoreModule.forRoot()
|
||||
],
|
||||
providers: [
|
||||
{ provide: TranslationService, useClass: TranslationMock }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(async(() => {
|
||||
|
||||
|
@@ -19,15 +19,17 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
|
||||
import { FormModule } from '../../index';
|
||||
import { formDefinitionDropdownField, formDefinitionTwoTextFields } from '../../mock';
|
||||
import { formReadonlyTwoTextFields } from '../../mock';
|
||||
import { formDefVisibilitiFieldDependsOnNextOne, formDefVisibilitiFieldDependsOnPreviousOne } from '../../mock';
|
||||
import { FormService } from './../services/form.service';
|
||||
import { FormComponent } from './form.component';
|
||||
import { setupTestBed } from '../../testing/setupTestBed';
|
||||
import { CoreModule } from '../../core.module';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
/** Duration of the select opening animation. */
|
||||
const SELECT_OPEN_ANIMATION = 200;
|
||||
@@ -35,7 +37,7 @@ const SELECT_OPEN_ANIMATION = 200;
|
||||
/** Duration of the select closing animation and the timeout interval for the backdrop. */
|
||||
const SELECT_CLOSE_ANIMATION = 500;
|
||||
|
||||
describe('FormComponent UI and visibiltiy', () => {
|
||||
describe('FormComponent UI and visibility', () => {
|
||||
let component: FormComponent;
|
||||
let service: FormService;
|
||||
let fixture: ComponentFixture<FormComponent>;
|
||||
@@ -47,19 +49,18 @@ describe('FormComponent UI and visibiltiy', () => {
|
||||
fixture.detectChanges();
|
||||
}
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
FormModule
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CoreModule.forRoot()
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(FormComponent);
|
||||
component = fixture.componentInstance;
|
||||
service = fixture.debugElement.injector.get(FormService);
|
||||
service = TestBed.get(FormService);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
@@ -18,22 +18,17 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA, SimpleChange } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { EntryComponentMockModule } from '../../mock/form/entry-module.mock';
|
||||
import { startFormDateWidgetMock, startFormDropdownDefinitionMock, startFormTextDefinitionMock, startMockForm, startMockFormWithTab } from '../../mock';
|
||||
import { startFormAmountWidgetMock, startFormNumberWidgetMock, startFormRadioButtonWidgetMock } from '../../mock';
|
||||
import { EcmModelService } from './../services/ecm-model.service';
|
||||
import { FormRenderingService } from './../services/form-rendering.service';
|
||||
import { FormService } from './../services/form.service';
|
||||
import { WidgetVisibilityService } from './../services/widget-visibility.service';
|
||||
import { FormFieldComponent } from './form-field/form-field.component';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { StartFormComponent } from './start-form.component';
|
||||
import { ContentWidgetComponent } from './widgets/content/content.widget';
|
||||
import { MASK_DIRECTIVE } from './widgets/index';
|
||||
import { WIDGET_DIRECTIVES } from './widgets/index';
|
||||
import { FormModel, FormOutcomeModel } from './widgets/index';
|
||||
import { setupTestBed } from '../../testing/setupTestBed';
|
||||
import { CoreModule } from '../../core.module';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
describe('ActivitiStartForm', () => {
|
||||
describe('StartFormComponent', () => {
|
||||
|
||||
let formService: FormService;
|
||||
let component: StartFormComponent;
|
||||
@@ -44,34 +39,19 @@ describe('ActivitiStartForm', () => {
|
||||
const exampleId1 = 'my:process1';
|
||||
const exampleId2 = 'my:process2';
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule,
|
||||
EntryComponentMockModule
|
||||
],
|
||||
declarations: [
|
||||
StartFormComponent,
|
||||
FormFieldComponent,
|
||||
ContentWidgetComponent,
|
||||
...WIDGET_DIRECTIVES,
|
||||
...MASK_DIRECTIVE
|
||||
],
|
||||
providers: [
|
||||
EcmModelService,
|
||||
FormService,
|
||||
FormRenderingService,
|
||||
WidgetVisibilityService
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CoreModule.forRoot()
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
fixture = TestBed.createComponent(StartFormComponent);
|
||||
component = fixture.componentInstance;
|
||||
formService = fixture.debugElement.injector.get(FormService);
|
||||
formService = TestBed.get(FormService);
|
||||
visibilityService = TestBed.get(WidgetVisibilityService);
|
||||
|
||||
getStartFormSpy = spyOn(formService, 'getStartFormDefinition').and.returnValue(Observable.of({
|
||||
|
@@ -15,36 +15,24 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MaterialModule } from '../../../../material.module';
|
||||
import { ActivitiContentService } from '../../../services/activiti-alfresco.service';
|
||||
import { ErrorWidgetComponent } from '../error/error.component';
|
||||
import { EcmModelService } from './../../../services/ecm-model.service';
|
||||
import { FormService } from './../../../services/form.service';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { FormFieldModel } from './../core/form-field.model';
|
||||
import { AmountWidgetComponent } from './amount.widget';
|
||||
import { setupTestBed } from '../../../../testing/setupTestBed';
|
||||
import { CoreModule } from '../../../../core.module';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
describe('AmountWidgetComponent', () => {
|
||||
|
||||
let widget: AmountWidgetComponent;
|
||||
let fixture: ComponentFixture<AmountWidgetComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
AmountWidgetComponent,
|
||||
ErrorWidgetComponent
|
||||
],
|
||||
providers: [
|
||||
FormService,
|
||||
EcmModelService,
|
||||
ActivitiContentService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CoreModule.forRoot()
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AmountWidgetComponent);
|
||||
@@ -52,7 +40,7 @@ describe('AmountWidgetComponent', () => {
|
||||
widget = fixture.componentInstance;
|
||||
});
|
||||
|
||||
it('should setup currentcy from field', () => {
|
||||
it('should setup currency from field', () => {
|
||||
const currency = 'UAH';
|
||||
widget.field = new FormFieldModel(null, {
|
||||
currency: currency
|
||||
|
@@ -15,41 +15,29 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ActivitiContentService } from '../../../services/activiti-alfresco.service';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MaterialModule } from '../../../../material.module';
|
||||
import { WIDGET_DIRECTIVES } from '../index';
|
||||
import { MASK_DIRECTIVE } from '../index';
|
||||
import { EcmModelService } from './../../../services/ecm-model.service';
|
||||
import { FormService } from './../../../services/form.service';
|
||||
import { FormFieldComponent } from './../../form-field/form-field.component';
|
||||
import { ContentWidgetComponent } from './../content/content.widget';
|
||||
import { ContainerColumnModel } from './../core/container-column.model';
|
||||
import { FormFieldTypes } from './../core/form-field-types';
|
||||
import { FormFieldModel } from './../core/form-field.model';
|
||||
import { FormModel } from './../core/form.model';
|
||||
import { ContainerWidgetComponent } from './container.widget';
|
||||
import { ContainerWidgetComponentModel } from './container.widget.model';
|
||||
import { setupTestBed } from '../../../../testing/setupTestBed';
|
||||
import { CoreModule } from '../../../../core.module';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
describe('ContainerWidgetComponent', () => {
|
||||
|
||||
let widget: ContainerWidgetComponent;
|
||||
let fixture: ComponentFixture<ContainerWidgetComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [FormFieldComponent, ContentWidgetComponent, WIDGET_DIRECTIVES, MASK_DIRECTIVE],
|
||||
providers: [
|
||||
FormService,
|
||||
EcmModelService,
|
||||
ActivitiContentService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CoreModule.forRoot()
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ContainerWidgetComponent);
|
||||
|
@@ -17,16 +17,17 @@
|
||||
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MaterialModule } from '../../../../material.module';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { TranslationService, ContentService } from '../../../../services';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
import { EcmModelService } from '../../../services/ecm-model.service';
|
||||
import { FormService } from '../../../services/form.service';
|
||||
import { ProcessContentService } from '../../../services/process-content.service';
|
||||
import { ContentLinkModel } from '../index';
|
||||
import { ContentWidgetComponent } from './content.widget';
|
||||
import { setupTestBed } from '../../../../testing/setupTestBed';
|
||||
import { CoreModule } from '../../../../core.module';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { TranslationMock } from '../../../../mock/translation.service.mock';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -62,30 +63,19 @@ describe('ContentWidgetComponent', () => {
|
||||
return new Blob([pdfData], {type: 'application/pdf'});
|
||||
}
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
ContentWidgetComponent
|
||||
],
|
||||
providers: [
|
||||
FormService,
|
||||
EcmModelService,
|
||||
ContentService,
|
||||
ProcessContentService
|
||||
]
|
||||
}).compileComponents();
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CoreModule.forRoot()
|
||||
],
|
||||
providers: [
|
||||
{ provide: TranslationService, useClass: TranslationMock }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(async(() => {
|
||||
serviceContent = TestBed.get(ContentService);
|
||||
processContentService = TestBed.get(ProcessContentService);
|
||||
|
||||
let translateService = TestBed.get(TranslationService);
|
||||
spyOn(translateService, 'addTranslationFolder').and.stub();
|
||||
spyOn(translateService, 'get').and.callFake((key) => {
|
||||
return Observable.of(key);
|
||||
});
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -17,14 +17,12 @@
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import moment from 'moment-es6';
|
||||
import { ActivitiContentService } from '../../../services/activiti-alfresco.service';
|
||||
import { MaterialModule } from '../../../../material.module';
|
||||
import { ErrorWidgetComponent } from '../error/error.component';
|
||||
import { EcmModelService } from './../../../services/ecm-model.service';
|
||||
import { FormService } from './../../../services/form.service';
|
||||
import { FormFieldModel } from './../core/form-field.model';
|
||||
import { FormModel } from './../core/form.model';
|
||||
import { DateTimeWidgetComponent } from './date-time.widget';
|
||||
import { setupTestBed } from '../../../../testing/setupTestBed';
|
||||
import { CoreModule } from '../../../../core.module';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
describe('DateTimeWidgetComponent', () => {
|
||||
|
||||
@@ -32,22 +30,12 @@ describe('DateTimeWidgetComponent', () => {
|
||||
let fixture: ComponentFixture<DateTimeWidgetComponent>;
|
||||
let element: HTMLElement;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
DateTimeWidgetComponent,
|
||||
ErrorWidgetComponent
|
||||
],
|
||||
providers: [
|
||||
FormService,
|
||||
EcmModelService,
|
||||
ActivitiContentService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CoreModule.forRoot()
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DateTimeWidgetComponent);
|
||||
@@ -58,7 +46,6 @@ describe('DateTimeWidgetComponent', () => {
|
||||
|
||||
afterEach(() => {
|
||||
fixture.destroy();
|
||||
TestBed.resetTestingModule();
|
||||
});
|
||||
|
||||
it('should setup min value for date picker', () => {
|
||||
|
@@ -17,14 +17,12 @@
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import moment from 'moment-es6';
|
||||
import { ActivitiContentService } from '../../../services/activiti-alfresco.service';
|
||||
import { MaterialModule } from '../../../../material.module';
|
||||
import { ErrorWidgetComponent } from '../error/error.component';
|
||||
import { EcmModelService } from './../../../services/ecm-model.service';
|
||||
import { FormService } from './../../../services/form.service';
|
||||
import { FormFieldModel } from './../core/form-field.model';
|
||||
import { FormModel } from './../core/form.model';
|
||||
import { DateWidgetComponent } from './date.widget';
|
||||
import { setupTestBed } from '../../../../testing/setupTestBed';
|
||||
import { CoreModule } from '../../../../core.module';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
describe('DateWidgetComponent', () => {
|
||||
|
||||
@@ -32,22 +30,12 @@ describe('DateWidgetComponent', () => {
|
||||
let fixture: ComponentFixture<DateWidgetComponent>;
|
||||
let element: HTMLElement;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
DateWidgetComponent,
|
||||
ErrorWidgetComponent
|
||||
],
|
||||
providers: [
|
||||
FormService,
|
||||
ActivitiContentService,
|
||||
EcmModelService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CoreModule.forRoot()
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DateWidgetComponent);
|
||||
|
@@ -18,15 +18,15 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { EcmModelService } from '../../../services/ecm-model.service';
|
||||
import { FormService } from '../../../services/form.service';
|
||||
import { WidgetVisibilityService } from '../../../services/widget-visibility.service';
|
||||
import { MaterialModule } from '../../../../material.module';
|
||||
import { ErrorWidgetComponent } from '../error/error.component';
|
||||
import { FormFieldOption } from './../core/form-field-option';
|
||||
import { FormFieldModel } from './../core/form-field.model';
|
||||
import { FormModel } from './../core/form.model';
|
||||
import { DropdownWidgetComponent } from './dropdown.widget';
|
||||
import { setupTestBed } from '../../../../testing/setupTestBed';
|
||||
import { CoreModule } from '../../../../core.module';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
describe('DropdownWidgetComponent', () => {
|
||||
|
||||
@@ -47,21 +47,20 @@ describe('DropdownWidgetComponent', () => {
|
||||
{ id: 'opt_2', name: 'option_2' },
|
||||
{ id: 'opt_3', name: 'option_3' }];
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CoreModule.forRoot()
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [DropdownWidgetComponent, ErrorWidgetComponent],
|
||||
providers: [FormService, EcmModelService, WidgetVisibilityService]
|
||||
}).compileComponents().then(() => {
|
||||
fixture = TestBed.createComponent(DropdownWidgetComponent);
|
||||
widget = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
formService = TestBed.get(FormService);
|
||||
visibilityService = TestBed.get(WidgetVisibilityService);
|
||||
widget.field = new FormFieldModel(new FormModel());
|
||||
});
|
||||
fixture = TestBed.createComponent(DropdownWidgetComponent);
|
||||
widget = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
formService = TestBed.get(FormService);
|
||||
visibilityService = TestBed.get(WidgetVisibilityService);
|
||||
widget.field = new FormFieldModel(new FormModel());
|
||||
}));
|
||||
|
||||
it('should require field with restUrl', () => {
|
||||
|
@@ -17,23 +17,15 @@
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { LogService } from '../../../../services';
|
||||
import { ActivitiContentService } from '../../../services/activiti-alfresco.service';
|
||||
import { WidgetVisibilityService } from '../../../services/widget-visibility.service';
|
||||
import { MaterialModule } from '../../../../material.module';
|
||||
import { ErrorWidgetComponent } from '../error/error.component';
|
||||
import { EcmModelService } from './../../../services/ecm-model.service';
|
||||
import { FormService } from './../../../services/form.service';
|
||||
import { FormFieldModel, FormFieldTypes, FormModel } from './../core/index';
|
||||
import { DynamicTableColumn } from './dynamic-table-column.model';
|
||||
import { DynamicTableRow } from './dynamic-table-row.model';
|
||||
import { DynamicTableWidgetComponent } from './dynamic-table.widget';
|
||||
import { DynamicTableModel } from './dynamic-table.widget.model';
|
||||
|
||||
import { BooleanEditorComponent } from './editors/boolean/boolean.editor';
|
||||
import { DateEditorComponent } from './editors/date/date.editor';
|
||||
import { DropdownEditorComponent } from './editors/dropdown/dropdown.editor';
|
||||
import { RowEditorComponent } from './editors/row.editor';
|
||||
import { TextEditorComponent } from './editors/text/text.editor';
|
||||
import { setupTestBed } from '../../../../testing/setupTestBed';
|
||||
import { CoreModule } from '../../../../core.module';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
let fakeFormField = {
|
||||
id: 'fake-dynamic-table',
|
||||
@@ -85,23 +77,12 @@ describe('DynamicTableWidgetComponent', () => {
|
||||
let logService: LogService;
|
||||
let formService: FormService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [DynamicTableWidgetComponent, RowEditorComponent,
|
||||
DropdownEditorComponent, DateEditorComponent, BooleanEditorComponent,
|
||||
TextEditorComponent, ErrorWidgetComponent],
|
||||
providers: [
|
||||
FormService,
|
||||
LogService,
|
||||
ActivitiContentService,
|
||||
EcmModelService,
|
||||
WidgetVisibilityService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CoreModule.forRoot()
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
const field = new FormFieldModel(new FormModel());
|
||||
|
@@ -15,15 +15,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import moment from 'moment-es6';
|
||||
import { MaterialModule } from '../../../../../../material.module';
|
||||
import { FormFieldModel, FormModel } from '../../../index';
|
||||
import { DynamicTableColumn } from './../../dynamic-table-column.model';
|
||||
import { DynamicTableRow } from './../../dynamic-table-row.model';
|
||||
import { DynamicTableModel } from './../../dynamic-table.widget.model';
|
||||
|
||||
import { DateEditorComponent } from './date.editor';
|
||||
import { setupTestBed } from '../../../../../../testing/setupTestBed';
|
||||
import { CoreModule } from '../../../../../../core.module';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
describe('DateEditorComponent', () => {
|
||||
let component: DateEditorComponent;
|
||||
@@ -32,16 +33,12 @@ describe('DateEditorComponent', () => {
|
||||
let column: DynamicTableColumn;
|
||||
let table: DynamicTableModel;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
DateEditorComponent
|
||||
],
|
||||
imports: [
|
||||
MaterialModule
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CoreModule.forRoot()
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DateEditorComponent);
|
||||
|
@@ -18,16 +18,16 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { EcmModelService } from '../../../../../services/ecm-model.service';
|
||||
import { MaterialModule } from '../../../../../../material.module';
|
||||
import { FormService } from './../../../../../services/form.service';
|
||||
import { FormFieldModel, FormModel } from './../../../core/index';
|
||||
import { DynamicTableColumnOption } from './../../dynamic-table-column-option.model';
|
||||
import { DynamicTableColumn } from './../../dynamic-table-column.model';
|
||||
import { DynamicTableRow } from './../../dynamic-table-row.model';
|
||||
import { DynamicTableModel } from './../../dynamic-table.widget.model';
|
||||
|
||||
import { DropdownEditorComponent } from './dropdown.editor';
|
||||
import { setupTestBed } from '../../../../../../testing/setupTestBed';
|
||||
import { CoreModule } from '../../../../../../core.module';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
describe('DropdownEditorComponent', () => {
|
||||
|
||||
@@ -38,6 +38,13 @@ describe('DropdownEditorComponent', () => {
|
||||
let column: DynamicTableColumn;
|
||||
let row: DynamicTableRow;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CoreModule.forRoot()
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
formService = new FormService(null, null, null);
|
||||
|
||||
@@ -190,20 +197,13 @@ describe('DropdownEditorComponent', () => {
|
||||
let dynamicTable: DynamicTableModel;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [MaterialModule],
|
||||
declarations: [DropdownEditorComponent],
|
||||
providers: [FormService, EcmModelService]
|
||||
}).compileComponents().then(() => {
|
||||
fixture = TestBed.createComponent(DropdownEditorComponent);
|
||||
dropDownEditorComponent = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
});
|
||||
fixture = TestBed.createComponent(DropdownEditorComponent);
|
||||
dropDownEditorComponent = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
}));
|
||||
|
||||
afterEach(() => {
|
||||
fixture.destroy();
|
||||
TestBed.resetTestingModule();
|
||||
});
|
||||
|
||||
describe('and dropdown is populated via taskId', () => {
|
||||
|
@@ -19,15 +19,14 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { UserProcessModel } from '../../../../models';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { ActivitiContentService } from '../../../services/activiti-alfresco.service';
|
||||
import { FormService } from '../../../services/form.service';
|
||||
import { MaterialModule } from '../../../../material.module';
|
||||
import { FormFieldTypes } from '../core/form-field-types';
|
||||
import { FormFieldModel } from '../core/form-field.model';
|
||||
import { FormModel } from '../core/form.model';
|
||||
import { ErrorWidgetComponent } from '../error/error.component';
|
||||
import { EcmModelService } from './../../../services/ecm-model.service';
|
||||
import { PeopleWidgetComponent } from './people.widget';
|
||||
import { setupTestBed } from '../../../../testing/setupTestBed';
|
||||
import { CoreModule } from '../../../../core.module';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
describe('PeopleWidgetComponent', () => {
|
||||
|
||||
@@ -36,22 +35,12 @@ describe('PeopleWidgetComponent', () => {
|
||||
let element: HTMLElement;
|
||||
let formService: FormService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
PeopleWidgetComponent,
|
||||
ErrorWidgetComponent
|
||||
],
|
||||
providers: [
|
||||
FormService,
|
||||
EcmModelService,
|
||||
ActivitiContentService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CoreModule.forRoot()
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PeopleWidgetComponent);
|
||||
|
@@ -17,23 +17,29 @@
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
import { EcmModelService } from '../../../services/ecm-model.service';
|
||||
import { FormService } from '../../../services/form.service';
|
||||
import { MaterialModule } from '../../../../material.module';
|
||||
import { ContainerModel } from '../core/container.model';
|
||||
import { FormFieldTypes } from '../core/form-field-types';
|
||||
import { ErrorWidgetComponent } from '../error/error.component';
|
||||
import { FormFieldOption } from './../core/form-field-option';
|
||||
import { FormFieldModel } from './../core/form-field.model';
|
||||
import { FormModel } from './../core/form.model';
|
||||
import { RadioButtonsWidgetComponent } from './radio-buttons.widget';
|
||||
import { setupTestBed } from '../../../../testing/setupTestBed';
|
||||
import { CoreModule } from '../../../../core.module';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
describe('RadioButtonsWidgetComponent', () => {
|
||||
|
||||
let formService: FormService;
|
||||
let widget: RadioButtonsWidgetComponent;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CoreModule.forRoot()
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
formService = new FormService(null, null, null);
|
||||
widget = new RadioButtonsWidgetComponent(formService, null);
|
||||
@@ -134,20 +140,13 @@ describe('RadioButtonsWidgetComponent', () => {
|
||||
}];
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ MaterialModule ],
|
||||
declarations: [RadioButtonsWidgetComponent, ErrorWidgetComponent],
|
||||
providers: [FormService, EcmModelService]
|
||||
}).compileComponents().then(() => {
|
||||
fixture = TestBed.createComponent(RadioButtonsWidgetComponent);
|
||||
radioButtonWidget = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
});
|
||||
fixture = TestBed.createComponent(RadioButtonsWidgetComponent);
|
||||
radioButtonWidget = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
}));
|
||||
|
||||
afterEach(() => {
|
||||
fixture.destroy();
|
||||
TestBed.resetTestingModule();
|
||||
});
|
||||
|
||||
describe('and radioButton is populated via taskId', () => {
|
||||
|
@@ -15,22 +15,31 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { fakeFormJson } from '../../../../mock';
|
||||
import { MaterialModule } from '../../../../material.module';
|
||||
import { tick, fakeAsync, async, ComponentFixture, TestBed, flush } from '@angular/core/testing';
|
||||
import { fakeFormJson, TranslationMock } from '../../../../mock';
|
||||
import { FormFieldModel } from '../core/form-field.model';
|
||||
import { FormModel } from '../core/form.model';
|
||||
import { TabModel } from '../core/tab.model';
|
||||
import { WIDGET_DIRECTIVES } from '../index';
|
||||
import { MASK_DIRECTIVE } from '../index';
|
||||
import { FormFieldComponent } from './../../form-field/form-field.component';
|
||||
import { ContentWidgetComponent } from './../content/content.widget';
|
||||
import { TabsWidgetComponent } from './tabs.widget';
|
||||
import { setupTestBed } from '../../../../testing/setupTestBed';
|
||||
import { CoreModule } from '../../../../core.module';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { TranslationService } from '../../../../services/translation.service';
|
||||
|
||||
describe('TabsWidgetComponent', () => {
|
||||
|
||||
let widget: TabsWidgetComponent;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CoreModule.forRoot()
|
||||
],
|
||||
providers: [
|
||||
{ provide: TranslationService, useClass: TranslationMock }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
widget = new TabsWidgetComponent();
|
||||
});
|
||||
@@ -56,7 +65,7 @@ describe('TabsWidgetComponent', () => {
|
||||
});
|
||||
|
||||
it('should remove invisible tabs', () => {
|
||||
let fakeTab = new TabModel(null, {id: 'fake-tab-id', title: 'fake-tab-title'});
|
||||
let fakeTab = new TabModel(null, { id: 'fake-tab-id', title: 'fake-tab-title' });
|
||||
fakeTab.isVisible = false;
|
||||
widget.tabs.push(fakeTab);
|
||||
widget.ngAfterContentChecked();
|
||||
@@ -65,7 +74,7 @@ describe('TabsWidgetComponent', () => {
|
||||
});
|
||||
|
||||
it('should leave visible tabs', () => {
|
||||
let fakeTab = new TabModel(null, {id: 'fake-tab-id', title: 'fake-tab-title'});
|
||||
let fakeTab = new TabModel(null, { id: 'fake-tab-id', title: 'fake-tab-title' });
|
||||
fakeTab.isVisible = true;
|
||||
widget.tabs.push(fakeTab);
|
||||
widget.ngAfterContentChecked();
|
||||
@@ -84,59 +93,66 @@ describe('TabsWidgetComponent', () => {
|
||||
let fakeTabInvisible: TabModel;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ MaterialModule ],
|
||||
declarations: [FormFieldComponent, ContentWidgetComponent, WIDGET_DIRECTIVES, MASK_DIRECTIVE]
|
||||
}).compileComponents().then(() => {
|
||||
fixture = TestBed.createComponent(TabsWidgetComponent);
|
||||
tabWidgetComponent = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
fixture = TestBed.createComponent(TabsWidgetComponent);
|
||||
tabWidgetComponent = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
|
||||
fakeTabVisible = new TabModel(new FormModel(fakeFormJson), {
|
||||
id: 'tab-id-visible',
|
||||
title: 'tab-title-visible'
|
||||
});
|
||||
fakeTabVisible.isVisible = true;
|
||||
fakeTabInvisible = new TabModel(new FormModel(fakeFormJson), {
|
||||
id: 'tab-id-invisible',
|
||||
title: 'tab-title-invisible'
|
||||
});
|
||||
fakeTabInvisible.isVisible = false;
|
||||
tabWidgetComponent.tabs.push(fakeTabVisible);
|
||||
tabWidgetComponent.tabs.push(fakeTabInvisible);
|
||||
fakeTabVisible = new TabModel(new FormModel(fakeFormJson), {
|
||||
id: 'tab-id-visible',
|
||||
title: 'tab-title-visible'
|
||||
});
|
||||
fakeTabVisible.isVisible = true;
|
||||
fakeTabInvisible = new TabModel(new FormModel(fakeFormJson), {
|
||||
id: 'tab-id-invisible',
|
||||
title: 'tab-title-invisible'
|
||||
});
|
||||
fakeTabInvisible.isVisible = false;
|
||||
tabWidgetComponent.tabs.push(fakeTabVisible);
|
||||
tabWidgetComponent.tabs.push(fakeTabInvisible);
|
||||
}));
|
||||
|
||||
it('should show only visible tabs', () => {
|
||||
it('should show only visible tabs', fakeAsync(() => {
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable()
|
||||
.then(() => {
|
||||
expect(element.innerText).toContain('tab-title-visible');
|
||||
});
|
||||
});
|
||||
|
||||
it('should show tab when it became visible', async(() => {
|
||||
tick(500);
|
||||
|
||||
expect(element.innerText).toContain('tab-title-visible');
|
||||
}));
|
||||
|
||||
it('should show tab when it became visible', fakeAsync(() => {
|
||||
fakeTabInvisible.isVisible = false;
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
tick(500);
|
||||
|
||||
tabWidgetComponent.formTabChanged.subscribe((res) => {
|
||||
tabWidgetComponent.tabs[1].isVisible = true;
|
||||
|
||||
tick(500);
|
||||
|
||||
flush();
|
||||
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable()
|
||||
.then(() => {
|
||||
expect(element.innerText).toContain('tab-title-invisible');
|
||||
});
|
||||
expect(element.innerText).toContain('tab-title-invisible');
|
||||
});
|
||||
tabWidgetComponent.tabChanged(null);
|
||||
}));
|
||||
|
||||
it('should hide tab when it became not visible', async(() => {
|
||||
it('should hide tab when it became not visible', fakeAsync(() => {
|
||||
fixture.detectChanges();
|
||||
|
||||
tick(500);
|
||||
|
||||
tabWidgetComponent.formTabChanged.subscribe((res) => {
|
||||
tabWidgetComponent.tabs[0].isVisible = false;
|
||||
|
||||
tick(500);
|
||||
|
||||
flush();
|
||||
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable()
|
||||
.then(() => {
|
||||
expect(element.querySelector('innerText')).not.toContain('tab-title-visible');
|
||||
});
|
||||
expect(element.querySelector('innerText')).not.toContain('tab-title-visible');
|
||||
});
|
||||
tabWidgetComponent.tabChanged(null);
|
||||
}));
|
||||
|
@@ -19,14 +19,10 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { FormFieldTypes } from '../core/form-field-types';
|
||||
import { FormFieldModel } from '../core/form-field.model';
|
||||
import { FormModel } from '../core/form.model';
|
||||
import { InputMaskDirective } from './text-mask.component';
|
||||
import { TextWidgetComponent } from './text.widget';
|
||||
|
||||
import { ActivitiContentService } from '../../../services/activiti-alfresco.service';
|
||||
import { MaterialModule } from '../../../../material.module';
|
||||
import { ErrorWidgetComponent } from '../error/error.component';
|
||||
import { EcmModelService } from './../../../services/ecm-model.service';
|
||||
import { FormService } from './../../../services/form.service';
|
||||
import { setupTestBed } from '../../../../testing/setupTestBed';
|
||||
import { CoreModule } from '../../../../core.module';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
describe('TextWidgetComponent', () => {
|
||||
|
||||
@@ -34,23 +30,12 @@ describe('TextWidgetComponent', () => {
|
||||
let fixture: ComponentFixture<TextWidgetComponent>;
|
||||
let element: HTMLElement;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
TextWidgetComponent,
|
||||
ErrorWidgetComponent,
|
||||
InputMaskDirective
|
||||
],
|
||||
providers: [
|
||||
FormService,
|
||||
EcmModelService,
|
||||
ActivitiContentService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CoreModule.forRoot()
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(TextWidgetComponent);
|
||||
|
@@ -19,21 +19,28 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { EcmModelService } from '../../../services/ecm-model.service';
|
||||
import { FormService } from '../../../services/form.service';
|
||||
import { MaterialModule } from '../../../../material.module';
|
||||
import { FormFieldOption } from '../core/form-field-option';
|
||||
import { FormFieldTypes } from '../core/form-field-types';
|
||||
import { FormFieldModel } from '../core/form-field.model';
|
||||
import { FormModel } from '../core/form.model';
|
||||
import { ErrorWidgetComponent } from '../error/error.component';
|
||||
import { TypeaheadWidgetComponent } from './typeahead.widget';
|
||||
import { setupTestBed } from '../../../../testing/setupTestBed';
|
||||
import { CoreModule } from '../../../../core.module';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
describe('TypeaheadWidgetComponent', () => {
|
||||
|
||||
let formService: FormService;
|
||||
let widget: TypeaheadWidgetComponent;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CoreModule.forRoot()
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
formService = new FormService(null, null, null);
|
||||
widget = new TypeaheadWidgetComponent(formService, null);
|
||||
@@ -223,15 +230,9 @@ describe('TypeaheadWidgetComponent', () => {
|
||||
}, { id: '3', name: 'Fake Name 3' }];
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [MaterialModule],
|
||||
declarations: [TypeaheadWidgetComponent, ErrorWidgetComponent],
|
||||
providers: [ FormService, EcmModelService]
|
||||
}).compileComponents().then(() => {
|
||||
fixture = TestBed.createComponent(TypeaheadWidgetComponent);
|
||||
typeaheadWidgetComponent = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
});
|
||||
fixture = TestBed.createComponent(TypeaheadWidgetComponent);
|
||||
typeaheadWidgetComponent = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
}));
|
||||
|
||||
afterEach(() => {
|
||||
@@ -261,7 +262,6 @@ describe('TypeaheadWidgetComponent', () => {
|
||||
|
||||
afterEach(() => {
|
||||
fixture.destroy();
|
||||
TestBed.resetTestingModule();
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -19,16 +19,15 @@ import { DebugElement } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
import { EcmModelService } from '../../../services/ecm-model.service';
|
||||
import { FormService } from '../../../services/form.service';
|
||||
import { ProcessContentService } from '../../../services/process-content.service';
|
||||
import { MaterialModule } from '../../../../material.module';
|
||||
import { FormFieldTypes } from '../core/form-field-types';
|
||||
import { FormModel } from '../core/form.model';
|
||||
import { ErrorWidgetComponent } from '../error/error.component';
|
||||
import { FormFieldModel } from './../core/form-field.model';
|
||||
import { UploadWidgetComponent } from './upload.widget';
|
||||
import { setupTestBed } from '../../../../testing/setupTestBed';
|
||||
import { CoreModule } from '../../../../core.module';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
let fakePngAnswer = {
|
||||
'id': 1155,
|
||||
@@ -67,6 +66,13 @@ describe('UploadWidgetComponent', () => {
|
||||
let filePngFake = new File(['fakePng'], 'file-fake.png', {type: 'image/png'});
|
||||
let filJpgFake = new File(['fakeJpg'], 'file-fake.jpg', {type: 'image/jpg'});
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CoreModule.forRoot()
|
||||
]
|
||||
});
|
||||
|
||||
describe('when template is ready', () => {
|
||||
let uploadWidgetComponent: UploadWidgetComponent;
|
||||
let fixture: ComponentFixture<UploadWidgetComponent>;
|
||||
@@ -76,17 +82,11 @@ describe('UploadWidgetComponent', () => {
|
||||
let formServiceInstance: FormService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ MaterialModule],
|
||||
declarations: [UploadWidgetComponent, ErrorWidgetComponent],
|
||||
providers: [FormService, EcmModelService, ProcessContentService]
|
||||
}).compileComponents().then(() => {
|
||||
fixture = TestBed.createComponent(UploadWidgetComponent);
|
||||
uploadWidgetComponent = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
debugElement = fixture.debugElement;
|
||||
contentService = TestBed.get(ProcessContentService);
|
||||
});
|
||||
fixture = TestBed.createComponent(UploadWidgetComponent);
|
||||
uploadWidgetComponent = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
debugElement = fixture.debugElement;
|
||||
contentService = TestBed.get(ProcessContentService);
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -96,7 +96,6 @@ describe('UploadWidgetComponent', () => {
|
||||
|
||||
afterEach(() => {
|
||||
fixture.destroy();
|
||||
TestBed.resetTestingModule();
|
||||
jasmine.Ajax.uninstall();
|
||||
});
|
||||
|
||||
|
@@ -15,13 +15,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ActivitiContentService } from '../../services/activiti-alfresco.service';
|
||||
import { EcmModelService } from './../../services/ecm-model.service';
|
||||
import { FormService } from './../../services/form.service';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { FormFieldModel } from './core/form-field.model';
|
||||
import { FormModel } from './core/form.model';
|
||||
import { WidgetComponent } from './widget.component';
|
||||
import { setupTestBed } from '../../../testing/setupTestBed';
|
||||
import { CoreModule } from '../../../core.module';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
describe('WidgetComponent', () => {
|
||||
|
||||
@@ -29,16 +29,12 @@ describe('WidgetComponent', () => {
|
||||
let fixture: ComponentFixture<WidgetComponent>;
|
||||
let element: HTMLElement;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [WidgetComponent],
|
||||
providers: [
|
||||
FormService,
|
||||
EcmModelService,
|
||||
ActivitiContentService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CoreModule.forRoot()
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(WidgetComponent);
|
||||
|
Reference in New Issue
Block a user