Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
[disabled]="certificate.uploading"
class="certificate-item-delete"
mat-icon-button
aria-label="Delete certificate"
attr.aria-label="Delete {{ certificate.name }} certificate"
(click)="deleteButtonClicked.emit(certificate.name)">
<mat-icon fontSet="material-symbols-outlined"> delete </mat-icon>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ describe('CertificateItemComponent', () => {
expect(deleteButton).toBeDefined();
});

it('should have certificate name as part of aria-label', () => {
expect(deleteButton?.ariaLabel?.trim()).toContain(certificate.name);
});

it('should emit delete event on delete button clicked', () => {
const deleteSpy = spyOn(component.deleteButtonClicked, 'emit');
deleteButton.click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@
rule
</mat-icon>
<p class="profile-item-name">{{ profile.name }}</p>
<button class="profile-item-button" mat-icon-button aria-label="Copy profile">
<button
class="profile-item-button copy"
mat-icon-button
attr.aria-label="Copy {{ profile.name }}">
<mat-icon fontSet="material-symbols-outlined"> content_copy </mat-icon>
</button>
<button
class="profile-item-button delete"
mat-icon-button
aria-label="Delete profile"
attr.aria-label="Delete {{ profile.name }}"
(click)="deleteButtonClicked.emit(profile.name)">
<mat-icon fontSet="material-symbols-outlined"> delete </mat-icon>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,19 @@ describe('ProfileItemComponent', () => {
it('should have profile name', () => {
const name = compiled.querySelector('.profile-item-name');

expect(name?.textContent?.trim()).toEqual('Profile name');
expect(name?.textContent?.trim()).toEqual(PROFILE_MOCK.name);
});

it('should have profile name as part of buttons aria-label', () => {
const deleteButton = fixture.nativeElement.querySelector(
'.profile-item-button.delete'
);
const copyButton = fixture.nativeElement.querySelector(
'.profile-item-button.copy'
);

expect(deleteButton?.ariaLabel?.trim()).toContain(PROFILE_MOCK.name);
expect(copyButton?.ariaLabel?.trim()).toContain(PROFILE_MOCK.name);
});

it('should emit delete event on delete button clicked', () => {
Expand All @@ -53,6 +65,6 @@ describe('ProfileItemComponent', () => {

deleteButton.click();

expect(deleteSpy).toHaveBeenCalledWith('Profile name');
expect(deleteSpy).toHaveBeenCalledWith(PROFILE_MOCK.name);
});
});