diff --git a/ng2-components/ng2-alfresco-search/src/components/alfresco-search-control.component.html b/ng2-components/ng2-alfresco-search/src/components/alfresco-search-control.component.html index ed950027f0..0343158ec7 100644 --- a/ng2-components/ng2-alfresco-search/src/components/alfresco-search-control.component.html +++ b/ng2-components/ng2-alfresco-search/src/components/alfresco-search-control.component.html @@ -4,7 +4,7 @@ search
- { let fixture: ComponentFixture; let component: AlfrescoSearchControlComponent, element: HTMLElement; + let componentHandler; beforeEach(async(() => { + componentHandler = jasmine.createSpyObj('componentHandler', ['upgradeAllRegistered', 'upgradeElement']); + window['componentHandler'] = componentHandler; TestBed.configureTestingModule({ imports: [ CoreModule @@ -348,7 +351,7 @@ describe('AlfrescoSearchControlComponent', () => { }); }); - it('should set un-active the search after file/folder is clicked', () => { + it('should set deactivate the search after file/folder is clicked', () => { component.searchActive = true; component.onFileClicked({ value: 'node12345' @@ -357,13 +360,13 @@ describe('AlfrescoSearchControlComponent', () => { expect(component.searchActive).toBe(false); }); - it('should reset the search term after file/folder is clicked', () => { + it('should NOT reset the search term after file/folder is clicked', () => { component.liveSearchTerm = 'test'; component.onFileClicked({ value: 'node12345' }); - expect(component.liveSearchTerm).toBe(''); + expect(component.liveSearchTerm).toBe('test'); }); }); }); diff --git a/ng2-components/ng2-alfresco-search/src/components/alfresco-search-control.component.ts b/ng2-components/ng2-alfresco-search/src/components/alfresco-search-control.component.ts index 3f0c1cc859..f49c056910 100644 --- a/ng2-components/ng2-alfresco-search/src/components/alfresco-search-control.component.ts +++ b/ng2-components/ng2-alfresco-search/src/components/alfresco-search-control.component.ts @@ -111,7 +111,6 @@ export class AlfrescoSearchControlComponent implements OnInit, OnDestroy { } private onSearchTermChange(value: string): void { - this.setAutoCompleteDisplayed(true); this.liveSearchTerm = value; this.searchControl.setValue(value, true); this.searchValid = this.searchControl.valid; @@ -171,8 +170,7 @@ export class AlfrescoSearchControlComponent implements OnInit, OnDestroy { } onFileClicked(event): void { - this.liveSearchTerm = ''; - this.searchActive = false; + this.setAutoCompleteDisplayed(false); this.fileSelect.emit(event); }