Merge pull request #1311 from Alfresco/dev-wabson-1294

Fix search control after logging out and back in
This commit is contained in:
Mario Romano
2016-12-16 16:17:14 +00:00
committed by GitHub
3 changed files with 8 additions and 7 deletions

View File

@@ -4,7 +4,7 @@
<i mdl-upgrade class="material-icons">search</i>
</label>
<div [class]="getTextFieldHolderClassName()">
<input mdl-upgrade
<input mdl
class="mdl-textfield__input"
[type]="inputType"
[autocomplete]="getAutoComplete()"

View File

@@ -35,8 +35,11 @@ describe('AlfrescoSearchControlComponent', () => {
let fixture: ComponentFixture<AlfrescoSearchControlComponent>;
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');
});
});
});

View File

@@ -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);
}