mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Merge pull request #1311 from Alfresco/dev-wabson-1294
Fix search control after logging out and back in
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
<i mdl-upgrade class="material-icons">search</i>
|
<i mdl-upgrade class="material-icons">search</i>
|
||||||
</label>
|
</label>
|
||||||
<div [class]="getTextFieldHolderClassName()">
|
<div [class]="getTextFieldHolderClassName()">
|
||||||
<input mdl-upgrade
|
<input mdl
|
||||||
class="mdl-textfield__input"
|
class="mdl-textfield__input"
|
||||||
[type]="inputType"
|
[type]="inputType"
|
||||||
[autocomplete]="getAutoComplete()"
|
[autocomplete]="getAutoComplete()"
|
||||||
|
@@ -35,8 +35,11 @@ describe('AlfrescoSearchControlComponent', () => {
|
|||||||
|
|
||||||
let fixture: ComponentFixture<AlfrescoSearchControlComponent>;
|
let fixture: ComponentFixture<AlfrescoSearchControlComponent>;
|
||||||
let component: AlfrescoSearchControlComponent, element: HTMLElement;
|
let component: AlfrescoSearchControlComponent, element: HTMLElement;
|
||||||
|
let componentHandler;
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
|
componentHandler = jasmine.createSpyObj('componentHandler', ['upgradeAllRegistered', 'upgradeElement']);
|
||||||
|
window['componentHandler'] = componentHandler;
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
CoreModule
|
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.searchActive = true;
|
||||||
component.onFileClicked({
|
component.onFileClicked({
|
||||||
value: 'node12345'
|
value: 'node12345'
|
||||||
@@ -357,13 +360,13 @@ describe('AlfrescoSearchControlComponent', () => {
|
|||||||
expect(component.searchActive).toBe(false);
|
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.liveSearchTerm = 'test';
|
||||||
component.onFileClicked({
|
component.onFileClicked({
|
||||||
value: 'node12345'
|
value: 'node12345'
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(component.liveSearchTerm).toBe('');
|
expect(component.liveSearchTerm).toBe('test');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -111,7 +111,6 @@ export class AlfrescoSearchControlComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private onSearchTermChange(value: string): void {
|
private onSearchTermChange(value: string): void {
|
||||||
this.setAutoCompleteDisplayed(true);
|
|
||||||
this.liveSearchTerm = value;
|
this.liveSearchTerm = value;
|
||||||
this.searchControl.setValue(value, true);
|
this.searchControl.setValue(value, true);
|
||||||
this.searchValid = this.searchControl.valid;
|
this.searchValid = this.searchControl.valid;
|
||||||
@@ -171,8 +170,7 @@ export class AlfrescoSearchControlComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onFileClicked(event): void {
|
onFileClicked(event): void {
|
||||||
this.liveSearchTerm = '';
|
this.setAutoCompleteDisplayed(false);
|
||||||
this.searchActive = false;
|
|
||||||
this.fileSelect.emit(event);
|
this.fileSelect.emit(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user