Skip to content

Commit 9ad99a6

Browse files
committed
refactor(course-update): improve HTML structure and accessibility attributes (CodeRabbit)
1 parent b187864 commit 9ad99a6

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/main/webapp/app/core/course/manage/update/course-update.component.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ <h4 class="form-group" jhiTranslate="artemisApp.course.form.sections.general"></
4343
</div>
4444
<div class="col-2">
4545
<div class="form-group" style="position: relative">
46-
<label class="form-control-label" jhiTranslate="artemisApp.course.color" for="field_title"></label>
46+
<label class="form-control-label" jhiTranslate="artemisApp.course.color"></label>
4747
<div
4848
class="color-preview form-control"
49+
role="button"
50+
[attr.aria-label]="'artemisApp.course.color' | artemisTranslate"
4951
[ngStyle]="{ backgroundColor: courseForm.get('color')!.value || ARTEMIS_DEFAULT_COLOR }"
5052
(click)="openColorSelector($event)"
5153
></div>
@@ -79,9 +81,14 @@ <h4 class="form-group" jhiTranslate="artemisApp.course.form.sections.general"></
7981
@for (organization of courseOrganizations; track organization) {
8082
<div>
8183
<h5>
82-
<span class="badge bg-primary font-weight-normal m-1" [ngClass]="{ 'ps-3': isAdmin }">
84+
<span class="badge bg-primary font-weight-normal m-2 ps-2">
8385
{{ organization.name }}
84-
<button id="removeOrganizationButton" type="button" class="btn text-light" (click)="removeOrganizationFromCourse(organization)">
86+
<button
87+
id="removeOrganizationButton-{{ organization.id }}"
88+
type="button"
89+
class="btn text-light"
90+
(click)="removeOrganizationFromCourse(organization)"
91+
>
8592
<fa-icon [icon]="faTimes" />
8693
</button>
8794
</span>

src/main/webapp/app/core/course/manage/update/course-update.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,8 +805,9 @@ describe('Course Management Update Component', () => {
805805
});
806806

807807
describe('changeOrganizations', () => {
808+
let organization: Organization;
808809
beforeEach(() => {
809-
const organization = new Organization();
810+
organization = new Organization();
810811
organization.id = 12345;
811812
jest.spyOn(organizationService, 'getOrganizationsByCourse').mockReturnValue(of([organization]));
812813
});
@@ -816,7 +817,7 @@ describe('Course Management Update Component', () => {
816817
fixture.detectChanges();
817818

818819
const addButton = fixture.debugElement.query(By.css('#addOrganizationButton'));
819-
const removeButton = fixture.debugElement.query(By.css('#removeOrganizationButton'));
820+
const removeButton = fixture.debugElement.query(By.css('#removeOrganizationButton-' + organization.id));
820821

821822
expect(addButton).not.toBeNull();
822823
expect(removeButton).not.toBeNull();

0 commit comments

Comments
 (0)