diff --git a/ng2-components/ng2-alfresco-documentlist/src/assets/alfresco.service.mock.ts b/ng2-components/ng2-alfresco-documentlist/src/assets/alfresco.service.mock.ts index dbeae24ba2..179c919e81 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/assets/alfresco.service.mock.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/assets/alfresco.service.mock.ts @@ -16,7 +16,6 @@ */ import {Observable} from 'rxjs/Observable'; -import { MinimalNodeEntity } from '../models/document-library.model'; import {AlfrescoService} from '../../src/services/alfresco.service'; import { AlfrescoSettingsService, @@ -29,9 +28,9 @@ export class AlfrescoServiceMock extends AlfrescoService { _folderToReturn: any = {}; constructor( - settings: AlfrescoSettingsService = null, - authService: AlfrescoAuthenticationService = null, - contentService: AlfrescoContentService = null + settings?: AlfrescoSettingsService, + authService?: AlfrescoAuthenticationService, + contentService?: AlfrescoContentService ) { super(settings, authService, contentService); } @@ -42,8 +41,4 @@ export class AlfrescoServiceMock extends AlfrescoService { observer.complete(); }); } - - getDocumentThumbnailUrl(folder: MinimalNodeEntity) { - return ''; - } } diff --git a/ng2-components/ng2-alfresco-documentlist/src/models/content-column.model.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/models/content-column.model.spec.ts new file mode 100644 index 0000000000..f030113cdc --- /dev/null +++ b/ng2-components/ng2-alfresco-documentlist/src/models/content-column.model.spec.ts @@ -0,0 +1,37 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { + it, + describe, + expect +} from '@angular/core/testing'; + +import { ContentColumnModel } from './content-column.model'; + +describe('ContentColumnModel', () => { + + it('should init with text type from config object', () => { + let model = new ContentColumnModel({}); + expect(model.type).toBe(ContentColumnModel.TYPE_TEXT); + }); + + it('should return supported types', () => { + expect(ContentColumnModel.getSupportedTypes().length).toBeGreaterThan(0); + }); + +}); diff --git a/ng2-components/ng2-alfresco-documentlist/src/models/content-column.model.ts b/ng2-components/ng2-alfresco-documentlist/src/models/content-column.model.ts index 3ea69b3b12..e5612eb011 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/models/content-column.model.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/models/content-column.model.ts @@ -16,11 +16,17 @@ */ export class ContentColumnModel { + + static TYPE_TEXT: string = 'text'; + static TYPE_DATE: string = 'date'; + static TYPE_IMAGE: string = 'image'; + // static TYPE_NUMBER: string = 'number'; + title: string; srTitle: string; source: string; cssClass: string; - type: string = 'text'; // text|date|image|number + type: string = ContentColumnModel.TYPE_TEXT; format: string = 'medium'; constructor(obj?: any) { @@ -29,8 +35,17 @@ export class ContentColumnModel { this.srTitle = obj.srTitle; this.source = obj.source; this.cssClass = obj.cssClass; - this.type = obj.type || 'text'; + this.type = obj.type || ContentColumnModel.TYPE_TEXT; this.format = obj.format; } } + + static getSupportedTypes(): string[] { + return [ + ContentColumnModel.TYPE_TEXT, + ContentColumnModel.TYPE_DATE, + ContentColumnModel.TYPE_IMAGE + // ContentColumnModel.TYPE_NUMBER + ]; + } }