mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
@@ -49,7 +49,9 @@ System.register(['angular2/core', 'angular2/http', 'rxjs/Observable', '../../../
|
|||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
this._host = 'http://127.0.0.1:8080';
|
this._host = 'http://127.0.0.1:8080';
|
||||||
this._baseUrlPath = '/alfresco/service/slingshot/doclib/doclist/all/site/';
|
this._baseUrlPath = '/alfresco/service/slingshot/doclib/doclist/all/site/';
|
||||||
this._host = settings.host;
|
if (settings) {
|
||||||
|
this._host = settings.host;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Object.defineProperty(AlfrescoService.prototype, "host", {
|
Object.defineProperty(AlfrescoService.prototype, "host", {
|
||||||
get: function () {
|
get: function () {
|
||||||
|
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"alfresco.service.js","sourceRoot":"","sources":["alfresco.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YASH;gBACI,yBACY,IAAU,EACV,QAAiC;oBADjC,SAAI,GAAJ,IAAI,CAAM;oBACV,aAAQ,GAAR,QAAQ,CAAyB;oBAKrC,UAAK,GAAW,uBAAuB,CAAC;oBACxC,iBAAY,GAAW,sDAAsD,CAAC;oBAJlF,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC;gBAC/B,CAAC;gBAKD,sBAAW,iCAAI;yBAAf;wBACI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;oBACtB,CAAC;yBAED,UAAgB,KAAY;wBACxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;oBACvB,CAAC;;;mBAJA;gBAMO,oCAAU,GAAlB;oBACI,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC;gBACzC,CAAC;gBAED,mCAAS,GAAT,UAAU,MAAc;oBACpB,IAAI,OAAO,GAAG,IAAI,cAAO,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,CAAC,EAAjB,CAAiB,CAAC,CAAC,iCAAiC;yBAC/D,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBACjC,CAAC;gBAED,iDAAuB,GAAvB,UAAwB,QAAwB;oBAC5C,MAAM,CAAC,IAAI,CAAC,KAAK;wBACb,6BAA6B;wBAC7B,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,mEAAmE,CAAC;gBACnH,CAAC;gBAED,uCAAa,GAAb,UAAc,QAAwB;oBAClC,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,oBAAoB,GAAG,QAAQ,CAAC,UAAU,CAAC;gBACnE,CAAC;gBAEO,qCAAW,GAAnB,UAAqB,KAAe;oBAChC,mFAAmF;oBACnF,4CAA4C;oBAC5C,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;oBACrB,MAAM,CAAC,uBAAU,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,cAAc,CAAC,CAAC;gBAClE,CAAC;gBAtDL;oBAAC,iBAAU,EAAE;;mCAAA;gBAuDb,sBAAC;YAAD,CAAC,AAtDD,IAsDC;YAtDD,6CAsDC,CAAA"}
|
@@ -27,7 +27,9 @@ export class AlfrescoService {
|
|||||||
private http: Http,
|
private http: Http,
|
||||||
private settings: AlfrescoSettingsService
|
private settings: AlfrescoSettingsService
|
||||||
) {
|
) {
|
||||||
this._host = settings.host;
|
if (settings) {
|
||||||
|
this._host = settings.host;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _host: string = 'http://127.0.0.1:8080';
|
private _host: string = 'http://127.0.0.1:8080';
|
||||||
|
@@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
* @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 {Http} from 'angular2/http';
|
||||||
|
import {Observable} from 'rxjs/Observable';
|
||||||
|
import {AlfrescoService} from '../../src/services/alfresco.service';
|
||||||
|
import {AlfrescoSettingsService} from '../../../ng2-alfresco-core/services';
|
||||||
|
|
||||||
|
export class AlfrescoServiceMock extends AlfrescoService {
|
||||||
|
|
||||||
|
_folderToReturn: any = {};
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
http: Http = null,
|
||||||
|
settings: AlfrescoSettingsService = null
|
||||||
|
) {
|
||||||
|
super(http, settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
getFolder(folder: string) {
|
||||||
|
return Observable.create(observer => {
|
||||||
|
observer.next(this._folderToReturn);
|
||||||
|
observer.complete();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@@ -15,9 +15,14 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {
|
||||||
|
it,
|
||||||
|
describe,
|
||||||
|
expect
|
||||||
|
} from 'angular2/testing';
|
||||||
import {DocumentList} from '../../src/components/document-list';
|
import {DocumentList} from '../../src/components/document-list';
|
||||||
import {ContentColumnModel} from '../../src/models/content-column.model';
|
import {ContentColumnModel} from '../../src/models/content-column.model';
|
||||||
|
import {AlfrescoServiceMock} from '../assets/alfresco.service.mock';
|
||||||
|
|
||||||
describe('document-list', () => {
|
describe('document-list', () => {
|
||||||
|
|
||||||
@@ -42,16 +47,17 @@ describe('document-list', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should setup default root for breadcrumb', () => {
|
it('should setup default root for breadcrumb', () => {
|
||||||
let service = {
|
|
||||||
getFolder: function() {
|
|
||||||
return Observable.create(observer => {
|
|
||||||
var value = {};
|
|
||||||
observer.next(value);
|
|
||||||
observer.complete();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
let service = new AlfrescoServiceMock();
|
||||||
|
/*
|
||||||
|
spyOn(service, 'getFolder').and.returnValue(
|
||||||
|
Observable.create(observer => {
|
||||||
|
var value = {};
|
||||||
|
observer.next(value);
|
||||||
|
observer.complete();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
*/
|
||||||
let list: DocumentList = new DocumentList(service);
|
let list: DocumentList = new DocumentList(service);
|
||||||
|
|
||||||
list.ngOnInit();
|
list.ngOnInit();
|
||||||
@@ -60,15 +66,12 @@ describe('document-list', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should fetch folder', () => {
|
it('should fetch folder', () => {
|
||||||
let folder = {};
|
let folder = {
|
||||||
let service = {
|
'nodeRef': 'workspace://SpacesStore/8bb36efb-c26d-4d2b-9199-ab6922f53c28'
|
||||||
getFolder: function() {
|
|
||||||
return Observable.create(observer => {
|
|
||||||
observer.next(folder);
|
|
||||||
observer.complete();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
let service = new AlfrescoServiceMock();
|
||||||
|
service._folderToReturn = folder;
|
||||||
|
|
||||||
let list: DocumentList = new DocumentList(service);
|
let list: DocumentList = new DocumentList(service);
|
||||||
list.ngOnInit();
|
list.ngOnInit();
|
||||||
|
|
||||||
@@ -77,12 +80,10 @@ describe('document-list', () => {
|
|||||||
|
|
||||||
it('should get content url', () => {
|
it('should get content url', () => {
|
||||||
let url = 'URL';
|
let url = 'URL';
|
||||||
let service = {
|
let service = new AlfrescoServiceMock();
|
||||||
getContentUrl(content:any) { return url; }
|
spyOn(service, 'getContentUrl').and.returnValue(url);
|
||||||
};
|
|
||||||
let list: DocumentList = new DocumentList(service);
|
|
||||||
|
|
||||||
spyOn(service, 'getContentUrl').and.callThrough();
|
let list: DocumentList = new DocumentList(service);
|
||||||
let result = list.getContentUrl(null);
|
let result = list.getContentUrl(null);
|
||||||
|
|
||||||
expect(result).toBe(url);
|
expect(result).toBe(url);
|
||||||
@@ -91,12 +92,10 @@ describe('document-list', () => {
|
|||||||
|
|
||||||
it('should get thumbnail url', () => {
|
it('should get thumbnail url', () => {
|
||||||
let url = 'URL';
|
let url = 'URL';
|
||||||
let service = {
|
let service = new AlfrescoServiceMock();
|
||||||
getDocumentThumbnailUrl(content:any) { return url; }
|
spyOn(service, 'getDocumentThumbnailUrl').and.returnValue(url);
|
||||||
};
|
|
||||||
let list: DocumentList = new DocumentList(service);
|
|
||||||
|
|
||||||
spyOn(service, 'getDocumentThumbnailUrl').and.callThrough();
|
let list: DocumentList = new DocumentList(service);
|
||||||
let result = list.getDocumentThumbnailUrl(null);
|
let result = list.getDocumentThumbnailUrl(null);
|
||||||
|
|
||||||
expect(result).toBe(url);
|
expect(result).toBe(url);
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
// for imports from the app folder
|
// for imports from the app folder
|
||||||
System.config({
|
System.config({
|
||||||
packages: {
|
packages: {
|
||||||
'app': {defaultExtension: 'js'},
|
'test': {defaultExtension: 'js'},
|
||||||
'src': {defaultExtension: 'js'},
|
'src': {defaultExtension: 'js'},
|
||||||
'ng2-alfresco-core': {defaultExtension: 'js'}
|
'ng2-alfresco-core': {defaultExtension: 'js'}
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
// #3. Import the spec file explicitly
|
// #3. Import the spec file explicitly
|
||||||
Promise.all([
|
Promise.all([
|
||||||
System.import('test/components/document-list.spec.js')/*,
|
System.import('test/components/document-list.spec')/*,
|
||||||
System.import('app/my-uppercase.pipe.spec')*/
|
System.import('app/my-uppercase.pipe.spec')*/
|
||||||
])
|
])
|
||||||
// #4. wait for all imports to load ...
|
// #4. wait for all imports to load ...
|
||||||
|
@@ -10,6 +10,12 @@
|
|||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"declaration": false
|
"declaration": false
|
||||||
},
|
},
|
||||||
|
"files": [
|
||||||
|
"../node_modules/angular2/typings/browser.d.ts",
|
||||||
|
"../typings/main/ambient/jasmine/index.d.ts",
|
||||||
|
"assets/alfresco.service.mock.ts",
|
||||||
|
"components/document-list.spec.ts"
|
||||||
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user