TSK-1720: Sort Workbasket Distribution Targets by type and name

This commit is contained in:
Sofie Hofmann 2021-08-25 11:28:40 +02:00
parent 0f65abb001
commit d8a8f47cb8
2 changed files with 24 additions and 22 deletions

View File

@ -33,7 +33,7 @@
[scrollWindow]="false" *ngIf="distributionTargets?.length > 0"> [scrollWindow]="false" *ngIf="distributionTargets?.length > 0">
<mat-selection-list #workbasket [multiple]="true"> <mat-selection-list #workbasket [multiple]="true">
<mat-list-option class="workbasket-distribution-targets__workbaskets-item" <mat-list-option class="workbasket-distribution-targets__workbaskets-item"
*ngFor="let workbasket of distributionTargets | orderBy: ['type', 'description']" *ngFor="let workbasket of distributionTargets | orderBy: ['type', 'name']"
[selected]="workbasket.selected" [selected]="workbasket.selected"
(click)="workbasket.selected = !workbasket.selected" (click)="workbasket.selected = !workbasket.selected"
[value]="workbasket.workbasketId"> [value]="workbasket.workbasketId">

View File

@ -1,4 +1,4 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { Component, DebugElement, Input, Pipe, PipeTransform } from '@angular/core'; import { Component, DebugElement, Input, Pipe, PipeTransform } from '@angular/core';
import { WorkbasketDistributionTargetsListComponent } from './workbasket-distribution-targets-list.component'; import { WorkbasketDistributionTargetsListComponent } from './workbasket-distribution-targets-list.component';
import { InfiniteScrollModule } from 'ngx-infinite-scroll'; import { InfiniteScrollModule } from 'ngx-infinite-scroll';
@ -39,7 +39,8 @@ describe('WorkbasketDistributionTargetsListComponent', () => {
let debugElement: DebugElement; let debugElement: DebugElement;
let component: WorkbasketDistributionTargetsListComponent; let component: WorkbasketDistributionTargetsListComponent;
beforeEach(async(() => { beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
MatIconModule, MatIconModule,
@ -58,7 +59,8 @@ describe('WorkbasketDistributionTargetsListComponent', () => {
component = fixture.componentInstance; component = fixture.componentInstance;
component.distributionTargets = workbasketReadStateMock.paginatedWorkbasketsSummary.workbaskets; component.distributionTargets = workbasketReadStateMock.paginatedWorkbasketsSummary.workbaskets;
component.side = Side.AVAILABLE; component.side = Side.AVAILABLE;
})); })
);
it('should create component', () => { it('should create component', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
@ -92,6 +94,6 @@ describe('WorkbasketDistributionTargetsListComponent', () => {
it('should call orderBy pipe', () => { it('should call orderBy pipe', () => {
const orderBySpy = jest.spyOn(OrderByMock.prototype, 'transform'); const orderBySpy = jest.spyOn(OrderByMock.prototype, 'transform');
fixture.detectChanges(); fixture.detectChanges();
expect(orderBySpy).toHaveBeenCalledWith(component.distributionTargets, ['type', 'description']); expect(orderBySpy).toHaveBeenCalledWith(component.distributionTargets, ['type', 'name']);
}); });
}); });