[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:
suzanadirla
2018-03-13 19:34:56 +02:00
committed by Eugenio Romano
parent 6dc758889f
commit 3a68382be0
3 changed files with 52 additions and 7 deletions

View File

@@ -205,15 +205,22 @@ export class ContentNodeSelectorPanelComponent implements OnInit {
}
/**
* Clear the search input
* Clear the search input and reset to last folder node in which search was performed
*/
clear(): void {
this.clearSearch();
this.folderIdToShow = this.siteId || this.currentFolderId;
}
/**
* Clear the search input and search related data
*/
clearSearch() {
this.searchTerm = '';
this.nodes = null;
this.skipCount = 0;
this.chosenNode = null;
this.showingSearchResults = false;
this.folderIdToShow = this.siteId || this.currentFolderId;
}
/**
@@ -221,7 +228,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit {
*/
private updateResults(): void {
if (this.searchTerm.length === 0) {
this.folderIdToShow = this.siteId || this.currentFolderId;
this.clear();
} else {
this.startNewSearch();
}
@@ -306,9 +313,8 @@ export class ContentNodeSelectorPanelComponent implements OnInit {
* Sets showingSearchResults state to be able to differentiate between search results or folder results
*/
onFolderChange(): void {
this.skipCount = 0;
this.infiniteScroll = false;
this.showingSearchResults = false;
this.clearSearch();
}
/**