mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2640] remove option configurable (#3772)
* add optional delete button in tag node list * add demo * fix lint
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<mat-chip-list>
|
||||
<mat-chip class="adf-tag-chips adf-primary-background-color" *ngFor="let currentEntry of tagsEntries; let idx = index">
|
||||
<span id="tag_name_{{idx}}">{{currentEntry.entry.tag}}</span>
|
||||
<button class="adf-tag-chips-delete" id="tag_chips_delete_{{currentEntry.entry.tag}}" type="button" (click)="removeTag(currentEntry.entry.id)">
|
||||
<button *ngIf="showDelete" class="adf-tag-chips-delete" id="tag_chips_delete_{{currentEntry.entry.tag}}" type="button" (click)="removeTag(currentEntry.entry.id)">
|
||||
<mat-icon class="adf-tag-chips-delete-icon adf-primary-contrast-text-color" matChipRemove>cancel</mat-icon>
|
||||
</button>
|
||||
</mat-chip>
|
||||
|
@@ -103,5 +103,35 @@ describe('TagNodeList', () => {
|
||||
|
||||
component.ngOnChanges();
|
||||
});
|
||||
|
||||
it('Should not show the delete tag button if showDelete is false', (done) => {
|
||||
component.nodeId = 'fake-node-id';
|
||||
component.showDelete = false;
|
||||
|
||||
component.results.subscribe(() => {
|
||||
fixture.detectChanges();
|
||||
|
||||
let deleteButton: any = element.querySelector('#tag_chips_delete_test1');
|
||||
expect(deleteButton).toBeNull();
|
||||
done();
|
||||
});
|
||||
|
||||
component.ngOnChanges();
|
||||
});
|
||||
|
||||
it('Should show the delete tag button if showDelete is true', (done) => {
|
||||
component.nodeId = 'fake-node-id';
|
||||
component.showDelete = true;
|
||||
|
||||
component.results.subscribe(() => {
|
||||
fixture.detectChanges();
|
||||
|
||||
let deleteButton: any = element.querySelector('#tag_chips_delete_test1');
|
||||
expect(deleteButton).not.toBeNull();
|
||||
done();
|
||||
});
|
||||
|
||||
component.ngOnChanges();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -34,6 +34,10 @@ export class TagNodeListComponent implements OnChanges {
|
||||
@Input()
|
||||
nodeId: string;
|
||||
|
||||
/** Show delete button */
|
||||
@Input()
|
||||
showDelete = true;
|
||||
|
||||
tagsEntries: any;
|
||||
|
||||
/** Emitted when a tag is selected. */
|
||||
|
Reference in New Issue
Block a user