[ADF-2246] [Destination Picker] The selection from the dropdown is ignored after 'Clear' action (#2908)

This commit is contained in:
suzanadirla 2018-02-05 13:24:19 +02:00 committed by Eugenio Romano
parent 05659b3837
commit b6cc8efe27
2 changed files with 21 additions and 1 deletions

View File

@ -462,6 +462,26 @@ describe('ContentNodeSelectorComponent', () => {
expect(component.showingSearchResults).toBeFalsy();
});
it('should show nodes from the same folder as selected in the dropdown on clearing the search input', (done) => {
typeToSearchBox('piccolo');
setTimeout(() => {
expect(searchSpy.calls.count()).toBe(1);
component.siteChanged(<SiteEntry> { entry: { guid: 'namek' } });
expect(searchSpy.calls.count()).toBe(2);
expect(searchSpy.calls.argsFor(1)).toEqual([defaultSearchOptions('piccolo', 'namek')]);
component.clear();
expect(component.searchTerm).toBe('');
expect(component.folderIdToShow).toBe('namek');
done();
}, 300);
});
it('should show the current folder\'s content instead of search results if search was not performed', () => {
let documentList = fixture.debugElement.query(By.directive(DocumentListComponent));
expect(documentList).not.toBeNull('Document list should be shown');

View File

@ -175,7 +175,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit {
this.skipCount = 0;
this.chosenNode = null;
this.showingSearchResults = false;
this.folderIdToShow = this.currentFolderId;
this.folderIdToShow = this.siteId || this.currentFolderId;
}
/**