Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="slab-twolist h-100">
<div class="slab-twolistdiv">
<label>{{'COMMON_AVAILABLE_FIELDS' | translate | async }} ({{ available.length }})</label>
<label>{{'COMMON_AVAILABLE_FIELDS' | translate | async }} ({{ (available | datafilter:firstListSearch).length }})</label>
<div>
<input type="text" class="form-control" [(ngModel)]="firstListSearch">
</div>
Expand All @@ -17,7 +17,7 @@
</ul>
</div>
</div>
<systelab-button type="link" id="slab-add-all" [disabled]="available.length == 0" (click)="addAll()">{{'COMMON_ADD_ALL' | translate | async }} ({{ available.length }})</systelab-button>
<systelab-button type="link" id="slab-add-all" [disabled]="available.length == 0" (click)="addAll()">{{'COMMON_ADD_ALL' | translate | async }} ({{ (available | datafilter:firstListSearch).length }})</systelab-button>
</div>
<div class="slab-twolistbuttondiv">
<button type="button" class="btn icon-angle-right" (click)="add()" title="{{'COMMON_ADD_SELECTED' | translate | async }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,33 @@ describe('Systelab Two list', () => {
expect(availableSelected)
.toEqual(3);
});
it('should be able to show only the size of filtered elements', () => {
const component = fixture.componentInstance;

component.availableColumns = [
new TwoListItem('Element 1', 'id1', false, true),
new TwoListItem('Element 2', 'id2', false, true),
new TwoListItem('Element 3', 'id3', false, true)
];

fixture.detectChanges();

const searchInput: HTMLInputElement = fixture.debugElement.nativeElement.querySelector('.slab-twolistdiv input.form-control');
const seacrchLabel: HTMLLabelElement = fixture.debugElement.nativeElement.querySelector('.slab-twolistdiv label');
const addAllText: HTMLButtonElement = fixture.debugElement.nativeElement.querySelector('#slab-add-all');

searchInput.value = '1';
searchInput.dispatchEvent(new Event('input'));
fixture.detectChanges();
checkIfListContains(fixture, 'left-list', 'Element 1');
checkIfListNotContains(fixture, 'left-list', 'Element 2');
checkIfListNotContains(fixture, 'left-list', 'Element 3');
expect(seacrchLabel.innerHTML).toContain('1');
expect(addAllText.innerHTML).toContain('1');
clickButton(fixture, '#slab-add-all');
checkIfListContains(fixture, 'right-list', 'Element 1');
checkIfListNotContains(fixture, 'right-list', 'Element 2');
checkIfListNotContains(fixture, 'right-list', 'Element 3');
});

});