mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
@@ -15,7 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {DocumentList} from '../../src/components/document-list';
|
||||
import {ContentColumnModel} from '../../src/models/content-column.model';
|
||||
|
||||
describe('document-list', () => {
|
||||
|
||||
@@ -25,4 +27,80 @@ describe('document-list', () => {
|
||||
expect(list.columns.length).not.toBe(0);
|
||||
});
|
||||
|
||||
it('should use custom columns instead of default ones', () => {
|
||||
let list: DocumentList = new DocumentList(null);
|
||||
let column: ContentColumnModel = {
|
||||
title: 'title',
|
||||
source: 'source',
|
||||
cssClass: 'css'
|
||||
};
|
||||
list.columns.push(column);
|
||||
|
||||
list.ngAfterContentInit();
|
||||
expect(list.columns.length).toBe(1);
|
||||
expect(list.columns[0]).toBe(column);
|
||||
});
|
||||
|
||||
it('should setup default root for breadcrumb', () => {
|
||||
let service = {
|
||||
getFolder: function() {
|
||||
return Observable.create(observer => {
|
||||
var value = {};
|
||||
observer.next(value);
|
||||
observer.complete();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
let list: DocumentList = new DocumentList(service);
|
||||
|
||||
list.ngOnInit();
|
||||
expect(list.route.length).toBe(1);
|
||||
expect(list.route[0]).toBe(list.rootFolder);
|
||||
});
|
||||
|
||||
it('should fetch folder', () => {
|
||||
let folder = {};
|
||||
let service = {
|
||||
getFolder: function() {
|
||||
return Observable.create(observer => {
|
||||
observer.next(folder);
|
||||
observer.complete();
|
||||
});
|
||||
}
|
||||
};
|
||||
let list: DocumentList = new DocumentList(service);
|
||||
list.ngOnInit();
|
||||
|
||||
expect(list.folder).toBe(folder);
|
||||
});
|
||||
|
||||
it('should get content url', () => {
|
||||
let url = 'URL';
|
||||
let service = {
|
||||
getContentUrl(content:any) { return url; }
|
||||
};
|
||||
let list: DocumentList = new DocumentList(service);
|
||||
|
||||
spyOn(service, 'getContentUrl').and.callThrough();
|
||||
let result = list.getContentUrl(null);
|
||||
|
||||
expect(result).toBe(url);
|
||||
expect(service.getContentUrl).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should get thumbnail url', () => {
|
||||
let url = 'URL';
|
||||
let service = {
|
||||
getDocumentThumbnailUrl(content:any) { return url; }
|
||||
};
|
||||
let list: DocumentList = new DocumentList(service);
|
||||
|
||||
spyOn(service, 'getDocumentThumbnailUrl').and.callThrough();
|
||||
let result = list.getDocumentThumbnailUrl(null);
|
||||
|
||||
expect(result).toBe(url);
|
||||
expect(service.getDocumentThumbnailUrl).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user