mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2465] Sometimes, navigating using the breadcrumb opens another folder instead of the clicked one - after search performed on the Content Node Selector (#3054)
* [ADF-2465] Sometimes, navigating using the breadcrumb opens another folder instead of the clicked one - after search performed on the Content Node Selector fixed bug added tests made sure that deleting search input field clears all search related data * [ADF-2465] change tests not to use setTimeouts
This commit is contained in:
committed by
Eugenio Romano
parent
6dc758889f
commit
3a68382be0
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { async, fakeAsync, tick, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { MinimalNodeEntryEntity, SiteEntry, SitePaging } from 'alfresco-js-api';
|
||||
import {
|
||||
@@ -54,6 +54,7 @@ const ONE_FOLDER_RESULT = {
|
||||
};
|
||||
|
||||
describe('ContentNodeSelectorComponent', () => {
|
||||
const debounceSearch = 200;
|
||||
let component: ContentNodeSelectorPanelComponent;
|
||||
let fixture: ComponentFixture<ContentNodeSelectorPanelComponent>;
|
||||
let searchService: SearchService;
|
||||
@@ -483,6 +484,44 @@ describe('ContentNodeSelectorComponent', () => {
|
||||
expect(component.showingSearchResults).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should clear the search field, nodes and chosenNode when deleting the search input', fakeAsync(() => {
|
||||
spyOn(component, 'clear').and.callThrough();
|
||||
typeToSearchBox('a');
|
||||
|
||||
tick(debounceSearch);
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(searchSpy.calls.count()).toBe(1);
|
||||
|
||||
typeToSearchBox('');
|
||||
|
||||
tick(debounceSearch);
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(searchSpy.calls.count()).toBe(1, 'no other search has been performed');
|
||||
expect(component.clear).toHaveBeenCalled();
|
||||
expect(component.folderIdToShow).toBe('cat-girl-nuku-nuku', 'back to the folder in which the search was performed');
|
||||
}));
|
||||
|
||||
it('should clear the search field, nodes and chosenNode on folder navigation in the results list', fakeAsync(() => {
|
||||
spyOn(component, 'clearSearch').and.callThrough();
|
||||
typeToSearchBox('a');
|
||||
|
||||
tick(debounceSearch);
|
||||
fixture.detectChanges();
|
||||
|
||||
respondWithSearchResults(ONE_FOLDER_RESULT);
|
||||
|
||||
tick();
|
||||
fixture.detectChanges();
|
||||
|
||||
component.onFolderChange();
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(component.clearSearch).toHaveBeenCalled();
|
||||
|
||||
}));
|
||||
|
||||
it('should show nodes from the same folder as selected in the dropdown on clearing the search input', (done) => {
|
||||
typeToSearchBox('piccolo');
|
||||
|
||||
|
Reference in New Issue
Block a user