mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
Fix for ACA upstream (#11642)
This commit is contained in:
@@ -341,13 +341,13 @@ describe('BaseQueryBuilderService', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update URL params even when query is null', async () => {
|
it('should not update URL params even when query is null', async () => {
|
||||||
spyOn(router, 'navigate').and.returnValue(Promise.resolve(true));
|
spyOn(router, 'navigate').and.returnValue(Promise.resolve(true));
|
||||||
service.userQuery = '';
|
service.userQuery = '';
|
||||||
|
|
||||||
await service.execute();
|
await service.execute();
|
||||||
|
|
||||||
expect(router.navigate).toHaveBeenCalled();
|
expect(router.navigate).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -446,11 +446,12 @@ describe('BaseQueryBuilderService', () => {
|
|||||||
it('should call execute when updating configuration', async () => {
|
it('should call execute when updating configuration', async () => {
|
||||||
spyOn(router, 'navigate').and.returnValue(Promise.resolve(true));
|
spyOn(router, 'navigate').and.returnValue(Promise.resolve(true));
|
||||||
spyOn(service.searchApi, 'search').and.returnValue(Promise.resolve({ list: { entries: [] } } as ResultSetPaging));
|
spyOn(service.searchApi, 'search').and.returnValue(Promise.resolve({ list: { entries: [] } } as ResultSetPaging));
|
||||||
|
spyOn(service, 'execute')
|
||||||
service.userQuery = 'test';
|
service.userQuery = 'test';
|
||||||
|
|
||||||
service.updateSelectedConfiguration('config-2');
|
service.updateSelectedConfiguration('config-2');
|
||||||
|
|
||||||
expect(router.navigate).toHaveBeenCalled();
|
expect(service.execute).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -374,11 +374,11 @@ export abstract class BaseQueryBuilderService {
|
|||||||
*/
|
*/
|
||||||
async execute(updateQueryParams = true, queryBody?: SearchRequest) {
|
async execute(updateQueryParams = true, queryBody?: SearchRequest) {
|
||||||
try {
|
try {
|
||||||
|
const query = queryBody ? queryBody : this.buildQuery();
|
||||||
|
if (query) {
|
||||||
if (updateQueryParams) {
|
if (updateQueryParams) {
|
||||||
this.updateSearchQueryParams();
|
this.updateSearchQueryParams();
|
||||||
}
|
}
|
||||||
const query = queryBody ? queryBody : this.buildQuery();
|
|
||||||
if (query) {
|
|
||||||
const resultSetPaging: ResultSetPaging = await this.searchApi.search(query);
|
const resultSetPaging: ResultSetPaging = await this.searchApi.search(query);
|
||||||
this.executed.next(resultSetPaging);
|
this.executed.next(resultSetPaging);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user