[ADF-4056][ADF-4060][ADF-3930] Content Node Selector fix (#4293)

* remove target when search

* content panel component infinite pagiantion and dropdown integration

* fix insight karma
This commit is contained in:
Eugenio Romano
2019-02-11 11:14:05 +00:00
committed by GitHub
parent 3263659ac2
commit cd4fb8d06d
11 changed files with 116 additions and 35 deletions

View File

@@ -116,6 +116,10 @@ describe('ContentNodeSelectorComponent', () => {
fixture.detectChanges();
});
it('should the document list use the server ordering', () => {
expect(component.documentList.sorting).toBe('server');
});
it('should trigger the select event when selection has been made', (done) => {
const expectedNode = <Node> {};
component.select.subscribe((nodes) => {
@@ -350,6 +354,13 @@ describe('ContentNodeSelectorComponent', () => {
const expectedDefaultFolderNode = <NodeEntry> { entry: { path: { elements: [] } } };
spyOn(documentListService, 'getFolderNode').and.returnValue(of(expectedDefaultFolderNode));
spyOn(documentListService, 'getFolder').and.returnValue(of({
list: {
pagination: {},
entries: [],
source: {}
}
}));
const sitesService = TestBed.get(SitesService);
spyOn(sitesService, 'getSites').and.returnValue(of({ list: { entries: [] } }));
@@ -364,6 +375,8 @@ describe('ContentNodeSelectorComponent', () => {
});
component.currentFolderId = 'cat-girl-nuku-nuku';
component.documentList.ngOnInit();
fixture.detectChanges();
});
@@ -775,6 +788,44 @@ describe('ContentNodeSelectorComponent', () => {
const paginationLoading = fixture.debugElement.query(spinnerSelector);
expect(paginationLoading).not.toBeNull();
}));
it('Should infinite pagination target be null when we use it for search ', fakeAsync(() => {
component.showingSearchResults = true;
typeToSearchBox('shenron');
tick(debounceSearch);
fixture.detectChanges();
tick(debounceSearch);
expect(component.target).toBeNull();
}));
it('Should infinite pagination target be present when search finish', fakeAsync(() => {
component.showingSearchResults = true;
typeToSearchBox('shenron');
tick(debounceSearch);
fixture.detectChanges();
typeToSearchBox('');
tick(debounceSearch);
fixture.detectChanges();
expect(component.target).not.toBeNull();
}));
it('Should infinite pagination target on init be the document list', fakeAsync(() => {
component.showingSearchResults = true;
expect(component.target).toEqual(component.documentList);
}));
});
});