mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-2128] facet container component (#3094)
* (wip) facet container * shaping out the API * code lint fixes * radiobox facet example * fields selector facet * search limits support * scope locations facet example * move custom search to 'search.query' config * use facet fields and queries from the config file * use facet filters * use facet buckets in query * preserve expanded/checked states * code cleanup and binding fixes * fix apis after rebase * extract query builder into separate class * code improvements * full chip list (merge facet fields with queries) * placeholder for range requests * move search infrastructure to ADF core * cleanup code * auto-search on init * move search components to the content services * selected facets chip list * split into separate components at ADF level * move the rest of the implementation to ADF * facet builder fixes and tests * translation support for category names * docs placeholders * update language level * unit tests and packaging updates * fix after rebase * remove fdescribe * some docs on search settings * rename components as per review * simplify chip list as per review * turn query builder into service * improve search service, integrate old search results * fix node selector integration * move service to the top module * update tests * remove fdescribe * update tests * test fixes * test fixes * test updates * fix tests * code and test fixes * remove fit * fix tests * fix tests * remove obsolete test * increase bundle threshold * update docs to reflect PR changes * fix docs
This commit is contained in:
committed by
Eugenio Romano
parent
d6f51c22aa
commit
ed48994e67
@@ -18,19 +18,18 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { SearchService } from '@alfresco/adf-core';
|
||||
import { QueryBody } from 'alfresco-js-api';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { SearchModule } from '../../index';
|
||||
import { differentResult, folderResult, result, SimpleSearchTestComponent } from '../../mock';
|
||||
|
||||
function fakeNodeResultSearch(searchNode: QueryBody): Observable<any> {
|
||||
function fakeNodeResultSearch(searchNode: QueryBody): Promise<any> {
|
||||
if (searchNode && searchNode.query.query === 'FAKE_SEARCH_EXMPL') {
|
||||
return Observable.of(differentResult);
|
||||
return Promise.resolve(differentResult);
|
||||
}
|
||||
if (searchNode && searchNode.filterQueries.length === 1 &&
|
||||
searchNode.filterQueries[0].query === "TYPE:'cm:folder'") {
|
||||
return Observable.of(folderResult);
|
||||
return Promise.resolve(folderResult);
|
||||
}
|
||||
return Observable.of(result);
|
||||
return Promise.resolve(result);
|
||||
}
|
||||
|
||||
describe('SearchComponent', () => {
|
||||
@@ -60,8 +59,10 @@ describe('SearchComponent', () => {
|
||||
});
|
||||
|
||||
it('should clear results straight away when a new search term is entered', (done) => {
|
||||
spyOn(searchService, 'search')
|
||||
.and.returnValues(Observable.of(result), Observable.of(differentResult));
|
||||
spyOn(searchService, 'search').and.returnValues(
|
||||
Promise.resolve(result),
|
||||
Promise.resolve(differentResult)
|
||||
);
|
||||
|
||||
component.setSearchWordTo('searchTerm');
|
||||
fixture.detectChanges();
|
||||
@@ -82,7 +83,7 @@ describe('SearchComponent', () => {
|
||||
|
||||
it('should display the returned search results', (done) => {
|
||||
spyOn(searchService, 'search')
|
||||
.and.returnValue(Observable.of(result));
|
||||
.and.returnValue(Promise.resolve(result));
|
||||
|
||||
component.setSearchWordTo('searchTerm');
|
||||
fixture.detectChanges();
|
||||
@@ -96,7 +97,7 @@ describe('SearchComponent', () => {
|
||||
|
||||
it('should emit error event when search call fail', (done) => {
|
||||
spyOn(searchService, 'search')
|
||||
.and.returnValue(Observable.fromPromise(Promise.reject({ status: 402 })));
|
||||
.and.returnValue(Promise.reject({ status: 402 }));
|
||||
component.setSearchWordTo('searchTerm');
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -108,8 +109,10 @@ describe('SearchComponent', () => {
|
||||
});
|
||||
|
||||
it('should be able to hide the result panel', (done) => {
|
||||
spyOn(searchService, 'search')
|
||||
.and.returnValues(Observable.of(result), Observable.of(differentResult));
|
||||
spyOn(searchService, 'search').and.returnValues(
|
||||
Promise.resolve(result),
|
||||
Promise.resolve(differentResult)
|
||||
);
|
||||
|
||||
component.setSearchWordTo('searchTerm');
|
||||
fixture.detectChanges();
|
||||
@@ -160,8 +163,7 @@ describe('SearchComponent', () => {
|
||||
});
|
||||
|
||||
it('should perform a search with a defaultNode if no searchnode is given', (done) => {
|
||||
spyOn(searchService, 'search')
|
||||
.and.returnValue(Observable.of(result));
|
||||
spyOn(searchService, 'search').and.returnValue(Promise.resolve(result));
|
||||
component.setSearchWordTo('searchTerm');
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
|
Reference in New Issue
Block a user