From 7200489d55e923e44774ec459304cc3b4b3aea6c Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Tue, 12 Nov 2024 20:20:14 +0200 Subject: [PATCH 1/2] scroll to top on email interstitial --- .../share-emails-domains/share-emails-domains.component.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/cdk/interstitials/share-emails-domains/share-emails-domains.component.ts b/src/app/cdk/interstitials/share-emails-domains/share-emails-domains.component.ts index 37394b38c..be75d51a8 100644 --- a/src/app/cdk/interstitials/share-emails-domains/share-emails-domains.component.ts +++ b/src/app/cdk/interstitials/share-emails-domains/share-emails-domains.component.ts @@ -1,9 +1,10 @@ -import { Component, EventEmitter, Input, Output } from '@angular/core' +import { Component, EventEmitter, Inject, Input, Output } from '@angular/core' import { PlatformInfoService } from '../../platform-info' import { AssertionVisibilityString, EmailsEndpoint } from 'src/app/types' import { FormBuilder, FormControl, FormGroup } from '@angular/forms' import { RecordEmailsService } from 'src/app/core/record-emails/record-emails.service' import { error } from 'console' +import { WINDOW } from '../../window' @Component({ selector: 'app-share-emails-domains', @@ -23,12 +24,14 @@ export class ShareEmailsDomainsComponent { constructor( public platformInfo: PlatformInfoService, private fb: FormBuilder, - private recordEmailsService: RecordEmailsService + private recordEmailsService: RecordEmailsService, + @Inject(WINDOW) private window: Window ) {} public loadingEmails = true @Output() finish = new EventEmitter() ngOnInit() { + this.window.scrollTo(0, 0) this.userPrivateDomains = this.getTop3MostRecentPrivateDomains( this.userEmailsJson ) From 3ca10ef1abf62fe70deec93d1d92a11dede156ce Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Tue, 12 Nov 2024 20:35:55 +0200 Subject: [PATCH 2/2] fix test --- .../share-emails-domains.component.spec.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/cdk/interstitials/share-emails-domains/share-emails-domains.component.spec.ts b/src/app/cdk/interstitials/share-emails-domains/share-emails-domains.component.spec.ts index fd7032fe5..cb70bcf5b 100644 --- a/src/app/cdk/interstitials/share-emails-domains/share-emails-domains.component.spec.ts +++ b/src/app/cdk/interstitials/share-emails-domains/share-emails-domains.component.spec.ts @@ -4,6 +4,8 @@ import { ShareEmailsDomainsComponent } from './share-emails-domains.component' import { FormBuilder, FormControl, FormGroup } from '@angular/forms' import { RecordEmailsService } from 'src/app/core/record-emails/record-emails.service' import { PlatformInfoService } from '../../platform-info' +import { WINDOW_PROVIDERS } from '../../window' +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' describe('ShareEmailsDomainsComponent', () => { let component: ShareEmailsDomainsComponent @@ -28,7 +30,9 @@ describe('ShareEmailsDomainsComponent', () => { provide: RecordEmailsService, useValue: {}, }, + WINDOW_PROVIDERS, ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], }) fixture = TestBed.createComponent(ShareEmailsDomainsComponent) component = fixture.componentInstance