Skip to content

Commit

Permalink
Save expand/collapse state (#330)
Browse files Browse the repository at this point in the history
  • Loading branch information
sofyakurilova authored Mar 13, 2024
1 parent 034d8ae commit a81ca2d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/ui/src/app/mocks/progress.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
TestsData,
} from '../model/testrun-status';

const TEST_DATA_RESULT: IResult[] = [
export const TEST_DATA_RESULT: IResult[] = [
{
name: 'dns.network.hostname_resolution',
description: 'The device should resolve hostnames',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</span>
</section>

<ng-container *ngFor="let item of dataSource">
<ng-container *ngFor="let item of dataSource; trackBy: trackTest">
<mat-expansion-panel
*ngIf="item.recommendations; else simpleRow"
[expanded]="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { IResult, StatusOfTestResult } from '../../../../model/testrun-status';
import { of } from 'rxjs';
import {
TEST_DATA,
TEST_DATA_RESULT,
TEST_DATA_RESULT_WITH_RECOMMENDATIONS,
} from '../../../../mocks/progress.mock';
import { TestRunService } from '../../../../services/test-run.service';
Expand Down Expand Up @@ -67,6 +68,12 @@ describe('ProgressTableComponent', () => {
);
expect(result).toEqual(expectedResult);
});

it('#trackTest should return name and status', () => {
expect(component.trackTest(1, TEST_DATA_RESULT[0])).toEqual(
'dns.network.hostname_resolutionCompliant'
);
});
});

describe('DOM tests', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,8 @@ export class ProgressTableComponent implements OnInit {
const message = this.stepsToResolve?.length === 1 ? 'row' : 'all rows';
return `${action} ${message}`;
}

public trackTest(index: number, item: IResult) {
return item.name + item.result;
}
}

0 comments on commit a81ca2d

Please sign in to comment.