Add unit test for hidden columns (#18873)

1. Fixes #18870

Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
Shijun Sun 2023-07-03 10:58:14 +08:00 committed by GitHub
parent d84b1d07d2
commit 8fe561865d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 13 deletions

View File

@ -159,4 +159,12 @@ describe('ListReplicationRuleComponent (inline template)', () => {
fixture.nativeElement.querySelector('.modal-body');
expect(body).toBeFalsy();
});
it('the length of hide array should equal to the number of column', async () => {
comp.loading = false;
fixture.detectChanges();
await fixture.whenStable();
const cols = fixture.nativeElement.querySelectorAll('clr-dg-column');
expect(cols.length).toEqual(comp.hiddenArray.length);
});
});

View File

@ -353,6 +353,13 @@ describe('ArtifactListTabComponent (inline template)', () => {
fixture.nativeElement.querySelector('.confirmation-title')
).toBeTruthy();
});
it('the length of hide array should equal to the number of column', async () => {
comp.loading = false;
fixture.detectChanges();
await fixture.whenStable();
const cols = fixture.nativeElement.querySelectorAll('.datagrid-column');
expect(cols.length).toEqual(comp.hiddenArray.length);
});
});
async function stepOpenAction(fixture, comp) {

View File

@ -162,19 +162,7 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy {
hiddenArray: boolean[] = getHiddenArrayFromLocalStorage(
PageSizeMapKeys.ARTIFACT_LIST_TAB_COMPONENT,
[
false,
false,
false,
false,
false,
false,
false,
true,
false,
false,
false,
]
[false, false, false, false, false, false, true, false, false, false]
);
deleteAccessorySub: Subscription;
copyDigestSub: Subscription;