code cleanup (#3210)

* code cleanup

* rollback changes

* remove dead code

* remove debug app config

* cleanup unused locales

* no-unused-vars rule

* test fixes and cleanup

* remove unnecessary translate modules
This commit is contained in:
Denys Vuika
2023-05-22 08:23:35 +01:00
committed by GitHub
parent 19e31adbb9
commit fd495f6e95
87 changed files with 197 additions and 841 deletions

View File

@@ -23,14 +23,12 @@
*/
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { By } from '@angular/platform-browser';
import { OpenInAppComponent } from './open-in-app.component';
import { initialState, LibTestingModule } from '../../testing/lib-testing-module';
import { provideMockStore } from '@ngrx/store/testing';
import { TranslateModule } from '@ngx-translate/core';
import { MatIconTestingModule } from '@angular/material/icon/testing';
import { MatIconModule } from '@angular/material/icon';
import { SharedModule } from '@alfresco/aca-shared';
describe('OpenInAppComponent', () => {
@@ -44,7 +42,7 @@ describe('OpenInAppComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [LibTestingModule, TranslateModule, SharedModule.forRoot(), MatIconModule, MatIconTestingModule],
imports: [LibTestingModule, SharedModule.forRoot(), MatIconTestingModule],
providers: [
provideMockStore({ initialState }),
{ provide: MAT_DIALOG_DATA, useValue: { redirectUrl: 'mockRedirectUrl' } },
@@ -59,14 +57,13 @@ describe('OpenInAppComponent', () => {
it('should redirect to app when click on `Open in App` button` ', async () => {
let currentLocation: string | string[];
const windowStub: Window & typeof globalThis = {
component.window = {
location: {
set href(value: string | string[]) {
currentLocation = value;
}
}
} as Window & typeof globalThis;
component.window = windowStub;
const saveButton = fixture.debugElement.query(By.css('[data-automation-id="open-in-app-button"]')).nativeElement;
saveButton.dispatchEvent(new Event('click'));
fixture.detectChanges();

View File

@@ -35,7 +35,7 @@ export interface OpenInAppDialogOptions {
encapsulation: ViewEncapsulation.None
})
export class OpenInAppComponent {
private redirectUrl: string;
private readonly redirectUrl: string;
public window: Window & typeof globalThis = window;
constructor(