fix artifact page bug (#19807)

* fix artifact page bug

* update testcase
This commit is contained in:
ShengqiWang 2024-01-15 14:09:56 +08:00 committed by GitHub
parent eb125419cc
commit 04a140332e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View File

@ -83,6 +83,7 @@
(clickLabel)="selectValue($event)"
[scope]="'p'"
[projectId]="projectId"
[dropdownOpened]="dropdownOpened"
[width]="200"
[ownedLabels]="getSelectLabel()">
</app-label-selector>

View File

@ -59,6 +59,6 @@ describe('LabelSelectorComponent', () => {
fixture.detectChanges();
await fixture.whenStable();
const checkIcon = fixture.nativeElement.querySelector('.check-icon');
expect(checkIcon.style.visibility).toEqual('visible');
expect(checkIcon.style.visibility).toEqual('hidden');
});
});

View File

@ -41,6 +41,8 @@ export class LabelSelectorComponent implements OnInit, OnChanges, OnDestroy {
scope: string = GLOBAL; // 'g' for global and 'p' for project, default 'g'
@Input()
projectId: number; // if scope = 'p', projectId is required
@Input()
dropdownOpened: boolean; // parent component opened status
candidateLabels: Label[] = [];
searchValue: string;
loading: boolean = false;
@ -159,7 +161,7 @@ export class LabelSelectorComponent implements OnInit, OnChanges, OnDestroy {
isSelect(label: Label): boolean {
if (this.ownedLabels?.length) {
return this.ownedLabels.some(item => {
return item.id === label.id;
return item.id === label.id && this.dropdownOpened;
});
}
return false;