mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
parent
4beda8e55e
commit
dda838be5e
@ -116,14 +116,12 @@ describe('AlfrescoSearchAutocompleteComponent', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
// it('should setup i18n folder', () => {
|
||||
// let translation = jasmine.createSpyObj('AlfrescoTranslationService', [
|
||||
// 'addTranslationFolder'
|
||||
// ]);
|
||||
// let search = new AlfrescoSearchAutocompleteComponent(null, translation, null);
|
||||
// expect(search).toBeDefined();
|
||||
//
|
||||
// });
|
||||
it('should setup i18n folder', () => {
|
||||
let translationService = alfrescoSearchComponentFixture.debugElement.injector.get(AlfrescoTranslationService);
|
||||
spyOn(translationService, 'addTranslationFolder');
|
||||
alfrescoSearchComponentFixture.detectChanges();
|
||||
expect(translationService.addTranslationFolder).toHaveBeenCalledWith('node_modules/ng2-alfresco-search/dist/src');
|
||||
});
|
||||
|
||||
it('should display search results when a search term is provided', () => {
|
||||
let searchTerm = { currentValue: 'customSearchTerm', previousValue: ''};
|
||||
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, OnInit, OnChanges, Output } from '@angular/core';
|
||||
import { AlfrescoSearchService } from './../services/alfresco-search.service';
|
||||
import { AlfrescoThumbnailService } from './../services/alfresco-thumbnail.service';
|
||||
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
|
||||
@ -28,14 +28,14 @@ declare let __moduleName: string;
|
||||
templateUrl: './alfresco-search-autocomplete.component.html',
|
||||
styleUrls: ['./alfresco-search-autocomplete.component.css']
|
||||
})
|
||||
export class AlfrescoSearchAutocompleteComponent implements OnChanges {
|
||||
export class AlfrescoSearchAutocompleteComponent implements OnInit, OnChanges {
|
||||
|
||||
baseComponentPath = __moduleName.replace('/components/alfresco-search-autocomplete.component.js', '');
|
||||
|
||||
@Input()
|
||||
searchTerm: string = '';
|
||||
|
||||
results: any;
|
||||
results: any = null;
|
||||
|
||||
errorMessage;
|
||||
|
||||
@ -54,10 +54,12 @@ export class AlfrescoSearchAutocompleteComponent implements OnChanges {
|
||||
constructor(private alfrescoSearchService: AlfrescoSearchService,
|
||||
private translate: AlfrescoTranslationService,
|
||||
private alfrescoThumbnailService: AlfrescoThumbnailService) {
|
||||
if (translate) {
|
||||
translate.addTranslationFolder('node_modules/ng2-alfresco-search/dist/src');
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.translate) {
|
||||
this.translate.addTranslationFolder('node_modules/ng2-alfresco-search/dist/src');
|
||||
}
|
||||
this.results = null;
|
||||
}
|
||||
|
||||
ngOnChanges(changes) {
|
||||
|
@ -147,11 +147,12 @@ describe('AlfrescoSearchComponent', () => {
|
||||
expect(search.searchTerm).toBeNull();
|
||||
});
|
||||
|
||||
// it('should setup i18n folder', () => {
|
||||
// let translationService = alfrescoSearchComponentFixture.debugElement.injector.get(AlfrescoTranslationService);
|
||||
// spyOn(translationService, 'addTranslationFolder');
|
||||
// expect(translationService.addTranslationFolder).toHaveBeenCalledWith('node_modules/ng2-alfresco-search/dist/src');
|
||||
// });
|
||||
it('should setup i18n folder', () => {
|
||||
let translationService = alfrescoSearchComponentFixture.debugElement.injector.get(AlfrescoTranslationService);
|
||||
spyOn(translationService, 'addTranslationFolder');
|
||||
alfrescoSearchComponentFixture.detectChanges();
|
||||
expect(translationService.addTranslationFolder).toHaveBeenCalledWith('node_modules/ng2-alfresco-search/dist/src');
|
||||
});
|
||||
|
||||
describe('Rendering search results', () => {
|
||||
|
||||
|
@ -45,7 +45,7 @@ export class AlfrescoSearchComponent implements OnChanges, OnInit {
|
||||
@Output()
|
||||
errorEmitter = new EventEmitter();
|
||||
|
||||
results: any;
|
||||
results: any = null;
|
||||
|
||||
errorMessage;
|
||||
|
||||
@ -55,15 +55,12 @@ export class AlfrescoSearchComponent implements OnChanges, OnInit {
|
||||
private translate: AlfrescoTranslationService,
|
||||
private _alfrescoThumbnailService: AlfrescoThumbnailService,
|
||||
@Optional() private route: ActivatedRoute) {
|
||||
|
||||
if (translate !== null) {
|
||||
translate.addTranslationFolder('node_modules/ng2-alfresco-search/dist/src');
|
||||
}
|
||||
|
||||
this.results = null;
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.translate !== null) {
|
||||
this.translate.addTranslationFolder('node_modules/ng2-alfresco-search/dist/src');
|
||||
}
|
||||
if (this.route) {
|
||||
this.route.params.forEach((params: Params) => {
|
||||
this.searchTerm = params.hasOwnProperty(this.queryParamName) ? params[this.queryParamName] : null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user