[ACS-8999] rename confirmation button label for closing conversation 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
This commit is contained in:
AleksanderSklorz
2024-11-28 10:44:29 +01:00
committed by GitHub
parent de391a2a22
commit bf58a190cf
4 changed files with 30 additions and 2 deletions

View File

@@ -36,6 +36,7 @@
&-actions { &-actions {
margin-top: 11px; margin-top: 11px;
margin-bottom: 1px; margin-bottom: 1px;
margin-left: 40px;
padding: 0; padding: 0;
align-items: flex-end; align-items: flex-end;
@@ -51,7 +52,6 @@
&-cancel-button, &-cancel-button,
&-discard-changes-button { &-discard-changes-button {
padding: 4px 12px;
height: 32px; height: 32px;
display: flex; display: flex;
align-items: center; align-items: center;

View File

@@ -20,4 +20,5 @@ export interface UnsavedChangesDialogData {
confirmButtonText?: string; confirmButtonText?: string;
descriptionText?: string; descriptionText?: string;
headerText?: string; headerText?: string;
maxWidth?: number | string;
} }

View File

@@ -123,6 +123,33 @@ describe('UnsavedChangesGuard', () => {
expectGuardToBe(true, done, true); expectGuardToBe(true, done, true);
afterClosed$.next(false); 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', () => { describe('Without auth', () => {

View File

@@ -49,7 +49,7 @@ export class UnsavedChangesGuard implements CanDeactivate<any> {
return this.unsaved return this.unsaved
? this.dialog ? this.dialog
.open<UnsavedChangesDialogComponent>(UnsavedChangesDialogComponent, { .open<UnsavedChangesDialogComponent>(UnsavedChangesDialogComponent, {
maxWidth: 346, maxWidth: this.data?.maxWidth ?? 346,
data: this.data data: this.data
}) })
.afterClosed() .afterClosed()