[no-issue] speed up test CS part 2 (#3009)

* remove tag and rating service the testbed

* remove unused import in modules

* pdf viewer async

* viewer test fixed

* remove testbed share datatable

* remove unused dependencies

* add missing parameter

* remove testbed from folder actions service

* TaskHeaderComponent async

* remove testbed from document actions and list

* remove unused import

* use done for nested test

* fast finish false
This commit is contained in:
Eugenio Romano
2018-02-28 17:15:52 +00:00
committed by GitHub
parent b359579078
commit 45426fd246
52 changed files with 410 additions and 561 deletions

View File

@@ -17,7 +17,6 @@
import { DebugElement } from '@angular/core';
import { async, discardPeriodicTasks, fakeAsync, ComponentFixture, TestBed, tick } from '@angular/core/testing';
import { MaterialModule } from '../../material.module';
import { By } from '@angular/platform-browser';
import { AuthenticationService, SearchService } from '@alfresco/adf-core';
import { ThumbnailService } from '@alfresco/adf-core';
@@ -41,9 +40,6 @@ describe('SearchControlComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
MaterialModule
],
declarations: [
SearchControlComponent,
SearchComponent,
@@ -271,7 +267,7 @@ describe('SearchControlComponent', () => {
});
}));
it('should close the autocomplete when user press ESCAPE', async(() => {
it('should close the autocomplete when user press ESCAPE', (done) => {
spyOn(component, 'isSearchBarActive').and.returnValue(true);
spyOn(searchService, 'search').and.returnValue(Observable.of(results));
fixture.detectChanges();
@@ -290,11 +286,12 @@ describe('SearchControlComponent', () => {
fixture.detectChanges();
resultElement = <HTMLElement> element.querySelector('#result_option_0');
expect(resultElement).toBeNull();
done();
});
});
}));
});
it('should close the autocomplete when user press ENTER on input', async(() => {
it('should close the autocomplete when user press ENTER on input', (done) => {
spyOn(component, 'isSearchBarActive').and.returnValue(true);
spyOn(searchService, 'search').and.returnValue(Observable.of(results));
fixture.detectChanges();
@@ -313,9 +310,10 @@ describe('SearchControlComponent', () => {
fixture.detectChanges();
resultElement = <HTMLElement> element.querySelector('#result_option_0');
expect(resultElement).toBeNull();
done();
});
});
}));
});
it('should focus input element when autocomplete list is cancelled', async(() => {
spyOn(component, 'isSearchBarActive').and.returnValue(true);
@@ -383,7 +381,7 @@ describe('SearchControlComponent', () => {
});
}));
it('should focus the input search when ARROW UP is pressed on the first list item', async(() => {
it('should focus the input search when ARROW UP is pressed on the first list item', (done) => {
spyOn(searchService, 'search').and.returnValue(Observable.of(results));
fixture.detectChanges();
let inputDebugElement = debugElement.query(By.css('#adf-control-input'));
@@ -404,9 +402,10 @@ describe('SearchControlComponent', () => {
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(document.activeElement.id).toBe('adf-control-input');
done();
});
});
}));
});
});
@@ -509,7 +508,7 @@ describe('SearchControlComponent', () => {
});
}));
it('should set deactivate the search after element is clicked', async(() => {
it('should set deactivate the search after element is clicked', (done) => {
spyOn(component, 'isSearchBarActive').and.returnValue(true);
spyOn(searchService, 'search').and.returnValue(Observable.of(results));
component.optionClicked.subscribe((item) => {
@@ -525,8 +524,9 @@ describe('SearchControlComponent', () => {
fixture.detectChanges();
let firstOption: DebugElement = debugElement.query(By.css('#result_name_0'));
firstOption.triggerEventHandler('click', null);
done();
});
}));
});
it('should NOT reset the search term after element is clicked', async(() => {
spyOn(component, 'isSearchBarActive').and.returnValue(true);