Skip to content

Commit

Permalink
implemntation: add click event to edit row.
Browse files Browse the repository at this point in the history
  • Loading branch information
hmoreras committed Oct 18, 2024
1 parent 819640c commit 66be914
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</tr>
</ng-template>
<ng-template pTemplate="body" let-locale>
<tr>
<tr (click)="store.openAddEditDialog(locale.id)" data-testId="locale-row">
<td [ngClass]="{ 'tag-padding': locale.defaultLanguage }" data-testId="locale-cell">
{{ locale.language }} ({{ locale.isoCode }})
@if (locale.defaultLanguage) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,16 @@ describe('DotLocalesListComponent', () => {

expect(spectator.query('.p-tag-success')).toHaveText('Default');
});

it('should open AddEditDialog with locale id when row is clicked', () => {
spectator.detectChanges();

jest.spyOn(spectator.component.store, 'openAddEditDialog');

const row = spectator.query(byTestId('locale-row'));

spectator.click(row);

expect(spectator.component.store.openAddEditDialog).toHaveBeenCalledWith(1);
});
});

0 comments on commit 66be914

Please sign in to comment.