mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-08-07 17:48:54 +00:00
Unit tests
This commit is contained in:
@@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {Observable} from 'rxjs/Observable';
|
||||||
import { MinimalNodeEntity } from '../models/document-library.model';
|
|
||||||
import {AlfrescoService} from '../../src/services/alfresco.service';
|
import {AlfrescoService} from '../../src/services/alfresco.service';
|
||||||
import {
|
import {
|
||||||
AlfrescoSettingsService,
|
AlfrescoSettingsService,
|
||||||
@@ -29,9 +28,9 @@ export class AlfrescoServiceMock extends AlfrescoService {
|
|||||||
_folderToReturn: any = {};
|
_folderToReturn: any = {};
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
settings: AlfrescoSettingsService = null,
|
settings?: AlfrescoSettingsService,
|
||||||
authService: AlfrescoAuthenticationService = null,
|
authService?: AlfrescoAuthenticationService,
|
||||||
contentService: AlfrescoContentService = null
|
contentService?: AlfrescoContentService
|
||||||
) {
|
) {
|
||||||
super(settings, authService, contentService);
|
super(settings, authService, contentService);
|
||||||
}
|
}
|
||||||
@@ -42,8 +41,4 @@ export class AlfrescoServiceMock extends AlfrescoService {
|
|||||||
observer.complete();
|
observer.complete();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getDocumentThumbnailUrl(folder: MinimalNodeEntity) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -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);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
@@ -16,11 +16,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export class ContentColumnModel {
|
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;
|
title: string;
|
||||||
srTitle: string;
|
srTitle: string;
|
||||||
source: string;
|
source: string;
|
||||||
cssClass: string;
|
cssClass: string;
|
||||||
type: string = 'text'; // text|date|image|number
|
type: string = ContentColumnModel.TYPE_TEXT;
|
||||||
format: string = 'medium';
|
format: string = 'medium';
|
||||||
|
|
||||||
constructor(obj?: any) {
|
constructor(obj?: any) {
|
||||||
@@ -29,8 +35,17 @@ export class ContentColumnModel {
|
|||||||
this.srTitle = obj.srTitle;
|
this.srTitle = obj.srTitle;
|
||||||
this.source = obj.source;
|
this.source = obj.source;
|
||||||
this.cssClass = obj.cssClass;
|
this.cssClass = obj.cssClass;
|
||||||
this.type = obj.type || 'text';
|
this.type = obj.type || ContentColumnModel.TYPE_TEXT;
|
||||||
this.format = obj.format;
|
this.format = obj.format;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static getSupportedTypes(): string[] {
|
||||||
|
return [
|
||||||
|
ContentColumnModel.TYPE_TEXT,
|
||||||
|
ContentColumnModel.TYPE_DATE,
|
||||||
|
ContentColumnModel.TYPE_IMAGE
|
||||||
|
// ContentColumnModel.TYPE_NUMBER
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user