mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2070][ADF-2071][ADF-2072] 'Load more' on destination picker does… (#2774)
* [ADF-2070][ADF-2071][ADF-2072] 'Load more' on destination picker doesn't display correct content of folders * [ADF-2070][ADF-2071][ADF-2072] add tests * [ADF-2070][ADF-2071][ADF-2072] 'Load more' on destination picker doesn't display correct content of folders
This commit is contained in:
committed by
Eugenio Romano
parent
413dcc9e45
commit
553ae4db7b
@@ -522,6 +522,34 @@ describe('ContentNodeSelectorComponent', () => {
|
||||
expect(searchSpy).toHaveBeenCalledWith(defaultSearchOptions('kakarot', undefined, skipCount));
|
||||
});
|
||||
|
||||
it('should be shown when pagination\'s hasMoreItems is true', () => {
|
||||
component.pagination = {
|
||||
hasMoreItems: true
|
||||
};
|
||||
fixture.detectChanges();
|
||||
|
||||
const pagination = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-search-pagination"]'));
|
||||
expect(pagination).not.toBeNull();
|
||||
});
|
||||
|
||||
it('button\'s callback should load the next batch of folder results when there is no searchTerm', () => {
|
||||
const skipCount = 5;
|
||||
|
||||
component.searchTerm = '';
|
||||
component.pagination = {
|
||||
hasMoreItems: true
|
||||
};
|
||||
fixture.detectChanges();
|
||||
|
||||
component.getNextPageOfSearch({skipCount});
|
||||
fixture.detectChanges();
|
||||
expect(component.searchTerm).toBe('');
|
||||
|
||||
expect(component.infiniteScroll).toBeTruthy();
|
||||
expect(component.skipCount).toBe(skipCount);
|
||||
expect(searchSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should set its loading state to true after search was started', (done) => {
|
||||
component.showingSearchResults = true;
|
||||
component.pagination = { hasMoreItems: true };
|
||||
|
@@ -202,7 +202,10 @@ export class ContentNodeSelectorPanelComponent implements OnInit {
|
||||
getNextPageOfSearch(event: Pagination): void {
|
||||
this.infiniteScroll = true;
|
||||
this.skipCount = event.skipCount;
|
||||
this.querySearch();
|
||||
|
||||
if (this.searchTerm.length > 0) {
|
||||
this.querySearch();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user