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