Skip to content

Commit

Permalink
[ACS-8999] rename confirmation button label for closing conversation …
Browse files Browse the repository at this point in the history
…dialog (#10431)

* [ACS-8999] Correct styles for buttons in unsaved changes dialog for different size of buttons, allowed to set maxWidth of unsaved changes dialog

* [ACS-8999] Unit tests
  • Loading branch information
AleksanderSklorz authored Nov 28, 2024
1 parent de391a2 commit bf58a19
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
&-actions {
margin-top: 11px;
margin-bottom: 1px;
margin-left: 40px;
padding: 0;
align-items: flex-end;

Expand All @@ -51,7 +52,6 @@

&-cancel-button,
&-discard-changes-button {
padding: 4px 12px;
height: 32px;
display: flex;
align-items: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ export interface UnsavedChangesDialogData {
confirmButtonText?: string;
descriptionText?: string;
headerText?: string;
maxWidth?: number | string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,33 @@ describe('UnsavedChangesGuard', () => {
expectGuardToBe(true, done, true);
afterClosed$.next(false);
});

it('should call open on dialog with correct parameters when maxWidth is not set', () => {
guard.unsaved = true;
guard.data = {
headerText: 'header'
};

guard.canDeactivate();
expect(dialog.open).toHaveBeenCalledWith(UnsavedChangesDialogComponent, {
maxWidth: 346,
data: guard.data
});
});

it('should call open on dialog with correct parameters when maxWidth is set', () => {
guard.unsaved = true;
guard.data = {
headerText: 'header',
maxWidth: 'none'
};

guard.canDeactivate();
expect(dialog.open).toHaveBeenCalledWith(UnsavedChangesDialogComponent, {
maxWidth: 'none',
data: guard.data
});
});
});

describe('Without auth', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class UnsavedChangesGuard implements CanDeactivate<any> {
return this.unsaved
? this.dialog
.open<UnsavedChangesDialogComponent>(UnsavedChangesDialogComponent, {
maxWidth: 346,
maxWidth: this.data?.maxWidth ?? 346,
data: this.data
})
.afterClosed()
Expand Down

0 comments on commit bf58a19

Please sign in to comment.