Added new version for component

This commit is contained in:
Vito Albano
2016-09-29 02:55:39 +01:00
parent 0d7f32a649
commit d946532f14
57 changed files with 2375 additions and 336 deletions

View File

@@ -14,12 +14,37 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// import { UserInfoComponent } from '../src/userinfo.component';
describe('Basic Example test ng2-alfresco-userinfo', () => {
import { UserInfoComponent } from './user-info.component';
import { EcmUserService } from '../services/ecm-user.service';
import { BpmUserService } from '../services/bpm-user.service';
import { AlfrescoAuthenticationService,
AlfrescoApiService,
AlfrescoSettingsService } from 'ng2-alfresco-core';
it('Test hello world', () => {
expect(true).toBe(true);
});
describe('User info component', () => {
let userInfoComp: UserInfoComponent;
let ecmUserService = new EcmUserService(null, null);
let bpmUserService = new BpmUserService(null);
let authService = new AlfrescoAuthenticationService(new AlfrescoSettingsService() ,
new AlfrescoApiService());
beforeEach(() => {
userInfoComp = new UserInfoComponent(ecmUserService, bpmUserService, authService);
});
it('should get the ecm user informations when is logged in', () => {
spyOn(ecmUserService, 'getUserInfo');
spyOn(bpmUserService, 'getCurrentUserInfo');
spyOn(authService, 'getAlfrescoApi').and.callThrough();
// spyOn(authService.getAlfrescoApi(), 'ecmAuth').and.callThrough();
spyOn(authService, 'getAlfrescoApi().ecmAuth.isLoggedIn').and.returnValue(true);
userInfoComp.ngOnInit();
expect(ecmUserService.getUserInfo).toHaveBeenCalledWith('-me-');
expect(bpmUserService.getCurrentUserInfo).not.toHaveBeenCalled();
});
});

View File

@@ -16,10 +16,10 @@
*/
import { Component, OnInit } from '@angular/core';
import { EcmUserService } from './../services/ecm-user.service';
import { BpmUserService } from './../services/bpm-user.service';
import { EcmUserModel } from './../models/ecm-user.model';
import { BpmUserModel } from './../models/bpm-user.model';
import { EcmUserService } from './../services/ecm-user.service';
import { BpmUserService } from './../services/bpm-user.service';
import { AlfrescoAuthenticationService } from 'ng2-alfresco-core';
declare let __moduleName: string;
@@ -27,21 +27,19 @@ declare let __moduleName: string;
@Component({
selector: 'ng2-alfresco-userinfo',
moduleId: __moduleName,
styleUrls: ['./userinfo.component.css'],
templateUrl: './userinfo.component.html',
providers: [EcmUserService, BpmUserService, AlfrescoAuthenticationService]
styleUrls: ['./user-info.component.css'],
templateUrl: './user-info.component.html'
})
export class UserInfoComponent implements OnInit {
private ecmUser: EcmUserModel;
private bpmUser: BpmUserModel;
private baseComponentPath = __moduleName.replace('userinfo.component.js', '');
private baseComponentPath = __moduleName.replace('components/user-info.component.js', '');
private anonymouseImageUrl: string = this.baseComponentPath + 'img/anonymous.gif';
public bpmUserImage: any;
public ecmUserImage: any;
constructor(private ecmUserService: EcmUserService,
private bpmUserService: BpmUserService,
public authService: AlfrescoAuthenticationService) {