Skip to content

Commit

Permalink
Pidp 1047/1048 window scroll console error&open multiple dialogs (#602)
Browse files Browse the repository at this point in the history
* windows scroll console error fix

* multiple dialog box fix

* added back scroll top

* Lint fix

* revert

* missing dependency

---------

Co-authored-by: Panos Hatzinikolaou <[email protected]>
  • Loading branch information
AdityaMantripragada and Paahn authored Oct 22, 2024
1 parent b57a5df commit 8e377f3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { provideAutoSpy } from 'jest-auto-spies';
import { ApiHttpClient } from '@app/core/resources/api-http-client.service';
import { FormUtilsService } from '@app/core/services/form-utils.service';
import { LoggerService } from '@app/core/services/logger.service';
import { UtilsService } from '@app/core/services/utils.service';

import { UserAccessAgreementResource } from './user-access-agreement-resource.service';
import { UserAccessAgreementPage } from './user-access-agreement.page';
Expand Down Expand Up @@ -46,6 +47,7 @@ describe('UserAccessAgreementPage', () => {
provideAutoSpy(LoggerService),
provideAutoSpy(Router),
provideAutoSpy(UserAccessAgreementResource),
provideAutoSpy(UtilsService),
],
});

Expand All @@ -61,7 +63,6 @@ describe('UserAccessAgreementPage', () => {
given('user wants to go back to the previous page', () => {
when('onBack is invoked', () => {
component.onBack();

then('router should navigate to root route', () => {
const rootRoute = mockActivatedRoute.snapshot.data.routes.root;
expect(router.navigate).toHaveBeenCalledWith([rootRoute]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
{{ options.cancelText }}
</button>
<button
id="submit"
*ngIf="!options.actionHide"
mat-flat-button
[color]="options.actionType"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { NgIf } from '@angular/common';
import {
AfterViewInit,
ChangeDetectionStrategy,
Component,
Inject,
Expand Down Expand Up @@ -44,7 +45,7 @@ import { DIALOG_DEFAULT_OPTION } from '../dialogs-properties.provider';
AnchorDirective,
],
})
export class ConfirmDialogComponent implements OnInit {
export class ConfirmDialogComponent implements OnInit, AfterViewInit {
public options: DialogOptions;
public dialogContentOutput: DialogContentOutput<unknown> | null;

Expand Down Expand Up @@ -84,6 +85,13 @@ export class ConfirmDialogComponent implements OnInit {
this.options.class && this.dialogRef.addPanelClass(this.options.class);
}

public ngAfterViewInit(): void {
const adjustSubmitFocus = document.querySelector(
'#submit',
) as HTMLButtonElement;
if (adjustSubmitFocus) adjustSubmitFocus.focus();
}

private getOptions(dialogOptions: DialogOptions): DialogOptions {
const options: DialogOptions = {
actionType: 'primary',
Expand Down

0 comments on commit 8e377f3

Please sign in to comment.