mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Added new version for component
This commit is contained in:
@@ -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();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user