mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACA-4099] Fix search query in content node selector (#6299)
This commit is contained in:
@@ -96,6 +96,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
sitesService = TestBed.inject(SitesService);
|
||||
contentNodeSelectorPanelService = TestBed.inject(ContentNodeSelectorPanelService);
|
||||
searchQueryBuilderService = component.queryBuilderService;
|
||||
component.queryBuilderService.resetToDefaults();
|
||||
|
||||
spyOn(nodeService, 'getNode').and.returnValue(of({ id: 'fake-node', path: { elements: [{ nodeType: 'st:site', name: 'fake-site'}] } }));
|
||||
searchSpy = spyOn(searchQueryBuilderService, 'execute');
|
||||
@@ -400,12 +401,12 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(updateSpy).toHaveBeenCalled();
|
||||
expect(searchQueryBuilderService.userQuery).toEqual('(search-term)');
|
||||
expect(searchQueryBuilderService.userQuery).toEqual('(search-term*)');
|
||||
expect(component.searchTerm).toEqual('search-term');
|
||||
}));
|
||||
|
||||
it('should perform a search when the queryBody gets updated and it is defined', async () => {
|
||||
searchQueryBuilderService.userQuery = 'search-term';
|
||||
searchQueryBuilderService.userQuery = 'search-term*';
|
||||
searchQueryBuilderService.update();
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -695,7 +696,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
});
|
||||
|
||||
it('should the query restrict the search to the site and not to the currentFolderId in case is changed', () => {
|
||||
component.queryBuilderService.userQuery = 'search-term';
|
||||
component.queryBuilderService.userQuery = 'search-term*';
|
||||
component.currentFolderId = 'my-root-id';
|
||||
component.restrictRootToCurrentFolderId = true;
|
||||
component.siteChanged(<SiteEntry> { entry: { guid: 'my-site-id' } });
|
||||
|
@@ -273,9 +273,9 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
||||
debounceTime(this.debounceSearch),
|
||||
takeUntil(this.onDestroy$)
|
||||
)
|
||||
.subscribe(searchValue => {
|
||||
.subscribe((searchValue: string) => {
|
||||
this.searchTerm = searchValue;
|
||||
this.queryBuilderService.userQuery = searchValue;
|
||||
this.queryBuilderService.userQuery = searchValue.length > 0 ? `${searchValue}*` : searchValue ;
|
||||
this.queryBuilderService.update();
|
||||
});
|
||||
|
||||
|
@@ -19,7 +19,7 @@ import { QueryBody } from '@alfresco/js-api';
|
||||
|
||||
export const mockQueryBody: QueryBody = <QueryBody> {
|
||||
query: {
|
||||
query: '(search-term)',
|
||||
query: '(search-term*)',
|
||||
language: 'afts'
|
||||
},
|
||||
include: ['path', 'allowableOperations'],
|
||||
|
Reference in New Issue
Block a user