mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
* #1112 Use the mdl-chip * fix unit test
This commit is contained in:
committed by
Mario Romano
parent
9655e51943
commit
f5d2269c2e
@@ -267,6 +267,7 @@ The component shows the details of the task id passed in input
|
|||||||
| `showFormRefreshButton` | {boolean} | optional | Toggle rendering of the `Refresh` button. |
|
| `showFormRefreshButton` | {boolean} | optional | Toggle rendering of the `Refresh` button. |
|
||||||
| `showFormSaveButton` | {boolean} | optional | Toggle rendering of the `Save` outcome button. |
|
| `showFormSaveButton` | {boolean} | optional | Toggle rendering of the `Save` outcome button. |
|
||||||
| `showFormCompleteButton` | {boolean} | optional | Toggle rendering of the Form `Complete` outcome button |
|
| `showFormCompleteButton` | {boolean} | optional | Toggle rendering of the Form `Complete` outcome button |
|
||||||
|
| `peopleIconImageUrl` | {string} | optional | Define a custom people icon image |
|
||||||
|
|
||||||
### Custom 'empty Activiti Task Details' template
|
### Custom 'empty Activiti Task Details' template
|
||||||
|
|
||||||
|
BIN
ng2-components/ng2-activiti-tasklist/src/assets/images/user.jpg
Normal file
BIN
ng2-components/ng2-activiti-tasklist/src/assets/images/user.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.8 KiB |
@@ -16,3 +16,21 @@
|
|||||||
padding-bottom: 0px;
|
padding-bottom: 0px;
|
||||||
padding-left: 0px;
|
padding-left: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mdl-chip-search-people{
|
||||||
|
margin: auto;
|
||||||
|
min-width: 60%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdl-chip-search-people:hover{
|
||||||
|
background-color: #c1c1c1;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdl-chip-search-people img{
|
||||||
|
margin-left: -30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdl-chip-search-people__text{
|
||||||
|
padding-left: 10px;
|
||||||
|
}
|
@@ -5,11 +5,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<ul class='mdl-list'>
|
<ul class='mdl-list'>
|
||||||
<li class="mdl-list__item fix-element-user-list" *ngFor="let user of userList">
|
<li class="mdl-list__item fix-element-user-list" *ngFor="let user of userList">
|
||||||
<span class="mdl-list__item-primary-content mdl-button mdl-js-button mdl-js-ripple-effect"
|
<button (click)="onRowClick(user)" id="user-{{user.id}}" class="mdl-chip mdl-chip--contact mdl-chip-search-people">
|
||||||
(click)="onRowClick(user)" id="user-{{user.id}}">
|
<img class="mdl-chip__contact" [src]="iconImageUrl || baseComponentPath + '/../assets/images/user.jpg'" />
|
||||||
<i class="material-icons md-light people-search__icon">face</i>
|
<span class="mdl-chip__text mdl-chip-search-people__text">{{getDisplayUser(user)}}</span>
|
||||||
{{getDisplayUser(user)}}
|
</button>
|
||||||
</span>
|
|
||||||
</li>
|
</li>
|
||||||
<div *ngIf="userList?.length === 0" id="no-user-found">
|
<div *ngIf="userList?.length === 0" id="no-user-found">
|
||||||
No user found to involve
|
No user found to involve
|
||||||
|
@@ -109,10 +109,11 @@ describe('ActivitiPeopleSearch', () => {
|
|||||||
searchInput.dispatchEvent(new Event('input'));
|
searchInput.dispatchEvent(new Event('input'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should send an event when an user is clicked', async(() => {
|
it('should send an event when an user is clicked', (done) => {
|
||||||
activitiPeopleSearchComponent.onRowClicked.subscribe((user) => {
|
activitiPeopleSearchComponent.onRowClicked.subscribe((user) => {
|
||||||
expect(user).toBeDefined();
|
expect(user).toBeDefined();
|
||||||
expect(user.firstName).toBe('fake-name');
|
expect(user.firstName).toBe('fake-name');
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
activitiPeopleSearchComponent.results = Observable.of(userArray);
|
activitiPeopleSearchComponent.results = Observable.of(userArray);
|
||||||
activitiPeopleSearchComponent.ngOnInit();
|
activitiPeopleSearchComponent.ngOnInit();
|
||||||
@@ -122,9 +123,9 @@ describe('ActivitiPeopleSearch', () => {
|
|||||||
let userToSelect = <HTMLElement> element.querySelector('#user-1');
|
let userToSelect = <HTMLElement> element.querySelector('#user-1');
|
||||||
userToSelect.click();
|
userToSelect.click();
|
||||||
});
|
});
|
||||||
}));
|
});
|
||||||
|
|
||||||
it('should remove clicked user', async(() => {
|
it('should remove clicked user', (done) => {
|
||||||
activitiPeopleSearchComponent.results = Observable.of(userArray);
|
activitiPeopleSearchComponent.results = Observable.of(userArray);
|
||||||
activitiPeopleSearchComponent.ngOnInit();
|
activitiPeopleSearchComponent.ngOnInit();
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -135,6 +136,7 @@ describe('ActivitiPeopleSearch', () => {
|
|||||||
fixture.whenStable()
|
fixture.whenStable()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(element.querySelector('#user-1')).toBeNull();
|
expect(element.querySelector('#user-1')).toBeNull();
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
}));
|
});
|
||||||
});
|
});
|
||||||
|
@@ -32,6 +32,11 @@ declare let componentHandler: any;
|
|||||||
|
|
||||||
export class ActivitiPeopleSearch implements OnInit, AfterViewInit {
|
export class ActivitiPeopleSearch implements OnInit, AfterViewInit {
|
||||||
|
|
||||||
|
baseComponentPath = module.id.replace('/activiti-people-search.component.js', '');
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
iconImageUrl: string;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
results: Observable<User[]>;
|
results: Observable<User[]>;
|
||||||
|
|
||||||
@@ -81,6 +86,7 @@ export class ActivitiPeopleSearch implements OnInit, AfterViewInit {
|
|||||||
onRowClick(userClicked: User) {
|
onRowClick(userClicked: User) {
|
||||||
this.onRowClicked.emit(userClicked);
|
this.onRowClicked.emit(userClicked);
|
||||||
this.userList = this.userList.filter((user) => {
|
this.userList = this.userList.filter((user) => {
|
||||||
|
this.searchUser.reset();
|
||||||
return user.id !== userClicked.id;
|
return user.id !== userClicked.id;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -7,14 +7,11 @@
|
|||||||
<div class="menu-container" *ngIf="people?.length > 0">
|
<div class="menu-container" *ngIf="people?.length > 0">
|
||||||
<ul class='mdl-list'>
|
<ul class='mdl-list'>
|
||||||
<li class="mdl-list__item" *ngFor="let user of people">
|
<li class="mdl-list__item" *ngFor="let user of people">
|
||||||
<span class="mdl-list__item-primary-content">
|
<span class="mdl-chip mdl-chip--contact mdl-chip--deletable">
|
||||||
<i class="material-icons mdl-list__item-icon">face</i>
|
<img class="mdl-chip__contact" [src]="iconImageUrl || baseComponentPath + '/../assets/images/user.jpg'" />
|
||||||
<span id="user-{{user.id}}">{{getDisplayUser(user)}}</span>
|
<span id="user-{{user.id}}" class="mdl-chip__text">{{getDisplayUser(user)}}</span>
|
||||||
|
<a *ngIf="!readOnly" class="mdl-chip__action"><i id="remove-{{user.id}}" (click)="removeInvolvedUser(user)" class="material-icons people__icon">cancel</i></a>
|
||||||
</span>
|
</span>
|
||||||
<a *ngIf="!readOnly" class="mdl-list__item-secondary-action">
|
|
||||||
<i id="remove" class="material-icons people__icon"
|
|
||||||
(click)="removeInvolvedUser(user)">delete</i>
|
|
||||||
</a>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -27,7 +24,8 @@
|
|||||||
<div class="mdl-dialog__content add-people-dialog__content">
|
<div class="mdl-dialog__content add-people-dialog__content">
|
||||||
<activiti-people-search (onSearch)="searchUser($event)"
|
<activiti-people-search (onSearch)="searchUser($event)"
|
||||||
(onRowClicked)="involveUser($event)"
|
(onRowClicked)="involveUser($event)"
|
||||||
[results]="peopleSearch$">
|
[results]="peopleSearch$"
|
||||||
|
[iconImageUrl]="iconImageUrl">
|
||||||
</activiti-people-search>
|
</activiti-people-search>
|
||||||
</div>
|
</div>
|
||||||
<div class="mdl-dialog__actions">
|
<div class="mdl-dialog__actions">
|
||||||
|
@@ -31,6 +31,11 @@ declare let dialogPolyfill: any;
|
|||||||
})
|
})
|
||||||
export class ActivitiPeople {
|
export class ActivitiPeople {
|
||||||
|
|
||||||
|
baseComponentPath = module.id.replace('/activiti-people.component.js', '');
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
iconImageUrl: string;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
people: User [] = [];
|
people: User [] = [];
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
(claim)="onClaimTask($event)"></activiti-task-header>
|
(claim)="onClaimTask($event)"></activiti-task-header>
|
||||||
<div class="mdl-grid">
|
<div class="mdl-grid">
|
||||||
<div class="mdl-cell mdl-cell--4-col">
|
<div class="mdl-cell mdl-cell--4-col">
|
||||||
<activiti-people [people]="taskPeople" [readOnly]="readOnlyForm"
|
<activiti-people [iconImageUrl]="peopleIconImageUrl" [people]="taskPeople" [readOnly]="readOnlyForm"
|
||||||
[taskId]="taskDetails.id"></activiti-people>
|
[taskId]="taskDetails.id"></activiti-people>
|
||||||
</div>
|
</div>
|
||||||
<div class="mdl-cell mdl-cell--4-col">
|
<div class="mdl-cell mdl-cell--4-col">
|
||||||
|
@@ -61,6 +61,9 @@ export class ActivitiTaskDetails implements OnInit, OnChanges {
|
|||||||
@Input()
|
@Input()
|
||||||
showFormRefreshButton: boolean = true;
|
showFormRefreshButton: boolean = true;
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
peopleIconImageUrl: string;
|
||||||
|
|
||||||
@Output()
|
@Output()
|
||||||
formSaved: EventEmitter<FormModel> = new EventEmitter<FormModel>();
|
formSaved: EventEmitter<FormModel> = new EventEmitter<FormModel>();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user