[MIGRATION] - Migrating to NG18

This commit is contained in:
VitoAlbano
2024-08-14 16:58:24 +01:00
committed by Vito Albano
parent 075e63d693
commit 06cfd684f1
123 changed files with 9783 additions and 11031 deletions

View File

@@ -4,7 +4,7 @@
"overrides": [
{
"files": ["*.ts"],
"extends": ["plugin:@nrwl/nx/angular"],
"extends": ["plugin:@nx/angular"],
"parserOptions": {
"project": ["lib/core/tsconfig.lib.json", "lib/core/tsconfig.spec.json"],
"createDefaultProgram": true
@@ -15,7 +15,12 @@
"@typescript-eslint/consistent-type-assertions": "warn",
"@typescript-eslint/prefer-for-of": "off",
"@typescript-eslint/member-ordering": "off",
"no-underscore-dangle": ["error", { "allowAfterThis": true }],
"no-underscore-dangle": [
"error",
{
"allowAfterThis": true
}
],
"no-shadow": "warn",
"quote-props": "warn",
"object-shorthand": "warn",
@@ -24,7 +29,6 @@
"arrow-body-style": "warn",
"@angular-eslint/no-output-native": "off",
"space-before-function-paren": "warn",
"@angular-eslint/component-selector": [
"error",
{
@@ -77,11 +81,10 @@
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"extends": ["plugin:@nx/angular-template"],
"rules": {
"@angular-eslint/template/no-autofocus": "error",
"@angular-eslint/template/no-positive-tabindex": "error",
"@angular-eslint/template/no-negated-async": "off"
}
}

View File

@@ -4,14 +4,19 @@ module.exports = {
...rootMain,
core: { ...rootMain.core, builder: 'webpack5' },
stories: [...rootMain.stories, '../**/*.stories.@(js|jsx|ts|tsx)'],
framework: {
name: "@storybook/angular",
options: (()=>console.log('loaded config!'))()
},
staticDirs: [
...rootMain.staticDirs,
{ from: __dirname + '/../src/lib/i18n', to: 'assets/adf-core/i18n' },
{ from: __dirname + '/../src/lib/assets/images', to: 'assets/images' }
],
addons: ['@storybook/addon-essentials', ...rootMain.addons]
addons: ['@storybook/addon-essentials', ...rootMain.addons],
docs: {}
};

View File

@@ -3,3 +3,4 @@ const rootPreview = require('../../../.storybook/preview');
export const parameters = {
...rootPreview.preview
};
export const tags = ['autodocs'];

View File

@@ -16,8 +16,8 @@
*/
import { Emitters, RequestOptions, ResultListDataRepresentationTaskRepresentation, SecurityOptions } from '@alfresco/js-api';
import { HttpParams } from '@angular/common/http';
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { HttpParams, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';
import { AdfHttpClient } from './adf-http-client.service';
import { AlfrescoApiResponseError } from './alfresco-api/alfresco-api.response-error';
@@ -58,9 +58,9 @@ describe('AdfHttpClient', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
providers: [AdfHttpClient]
});
imports: [],
providers: [AdfHttpClient, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
});
angularHttpClient = TestBed.inject(AdfHttpClient);
controller = TestBed.inject(HttpTestingController);
});

View File

@@ -17,15 +17,7 @@
import { SHOULD_ADD_AUTH_TOKEN } from '@alfresco/adf-core/auth';
import { Emitters as JsApiEmitters, HttpClient as JsApiHttpClient } from '@alfresco/js-api';
import {
HttpClient,
HttpContext,
HttpErrorResponse,
HttpEvent,
HttpHeaders,
HttpParams,
HttpResponse
} from '@angular/common/http';
import { HttpClient, HttpContext, HttpErrorResponse, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, of, Subject, throwError } from 'rxjs';
import { catchError, map, takeUntil } from 'rxjs/operators';

View File

@@ -15,18 +15,7 @@
* limitations under the License.
*/
import {
HttpContextToken,
HttpHandler,
HttpHeaderResponse,
HttpHeaders,
HttpInterceptor,
HttpProgressEvent,
HttpRequest,
HttpResponse,
HttpSentEvent,
HttpUserEvent
} from '@angular/common/http';
import { HttpContextToken, HttpHandler, HttpHeaderResponse, HttpHeaders, HttpInterceptor, HttpProgressEvent, HttpRequest, HttpResponse, HttpSentEvent, HttpUserEvent } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, throwError as observableThrowError } from 'rxjs';
import { catchError, mergeMap } from 'rxjs/operators';

View File

@@ -2,15 +2,15 @@
@use '@angular/material' as mat;
@mixin adf-breadcrumb-theme($theme) {
$config: mat.get-color-config($theme);
$config: mat.m2-get-color-config($theme);
$foreground-palette: map.get($config, foreground);
$primary-palette: map.get($config, primary);
$text-color: mat.get-color-from-palette($foreground-palette, text);
$primary: mat.get-color-from-palette($primary-palette, text);
$text-color: mat.m2-get-color-from-palette($foreground-palette, text);
$primary: mat.m2-get-color-from-palette($primary-palette, text);
adf-breadcrumb {
.adf-breadcrumb__show-all-button-icon--rotate {
color: mat.get-color-from-palette($primary-palette, 500);
color: mat.m2-get-color-from-palette($primary-palette, 500);
}
.adf-breadcrumb__item-wrapper {

View File

@@ -7,21 +7,21 @@
@if ($primary-color) {
$custom-theme-primary-palette: create-color-palette($primary-color, 'primary');
$mat-primary-palette: mat.define-palette($custom-theme-primary-palette, 500);
$mat-primary-palette: mat.m2-define-palette($custom-theme-primary-palette, 500);
} @else {
$mat-primary-palette: mat.define-palette($default-primary, A100);
$mat-primary-palette: mat.m2-define-palette($default-primary, A100);
}
$mat-accent-palette: null;
@if ($accent-color) {
$custom-theme-accent-palette: create-color-palette($accent-color, 'accent');
$mat-accent-palette: mat.define-palette($custom-theme-accent-palette, 500);
$mat-accent-palette: mat.m2-define-palette($custom-theme-accent-palette, 500);
} @else {
$mat-accent-palette: mat.define-palette($default-accent);
$mat-accent-palette: mat.m2-define-palette($default-accent);
}
$mat-warn-palette: mat.define-palette($default-warn, A100);
$mat-warn-palette: mat.m2-define-palette($default-warn, A100);
@return (
primary: $mat-primary-palette,

View File

@@ -21,6 +21,6 @@
@use '@angular/material' as mat;
$default-primary: mat.$indigo-palette;
$default-accent: mat.$pink-palette;
$default-warn: mat.$red-palette;
$default-primary: mat.$m2-indigo-palette;
$default-accent: mat.$m2-pink-palette;
$default-warn: mat.$m2-red-palette;

View File

@@ -3,44 +3,44 @@
@import '../variables/font-family';
@function get-mat-typography($base-font-size, $font-family) {
$custom-typography: mat.define-legacy-typography-configmat.define-typography-config(
$custom-typography: mat.define-legacy-typography-configmat.m2-define-typography-config(
$font-family: 'Muli, Roboto, "Helvetica Neue", sans-serif',
$headline-1: mat.define-typography-level(112px, 112px, 300),
$headline-2: mat.define-typography-level(56px, 56px, 400),
$headline-3: mat.define-typography-level(45px, 48px, 400),
$headline-4: mat.define-typography-level(34px, 40px, 400),
$headline-5: mat.define-typography-level(24px, 32px, 400),
$headline-6: mat.define-typography-level(20px, 32px, 500),
$subtitle-1: mat.define-typography-level(16px, 28px, 400),
$body-1: mat.define-typography-level(15px, 24px, 400),
$subtitle-2: mat.define-typography-level(14px, 24px, 500),
$body-2: mat.define-typography-level(14px, 20px, 400),
$caption: mat.define-typography-level(12px, 20px, 400),
$button: mat.define-typography-level(14px, 14px, 500),
$headline-1: mat.m2-define-typography-level(112px, 112px, 300),
$headline-2: mat.m2-define-typography-level(56px, 56px, 400),
$headline-3: mat.m2-define-typography-level(45px, 48px, 400),
$headline-4: mat.m2-define-typography-level(34px, 40px, 400),
$headline-5: mat.m2-define-typography-level(24px, 32px, 400),
$headline-6: mat.m2-define-typography-level(20px, 32px, 500),
$subtitle-1: mat.m2-define-typography-level(16px, 28px, 400),
$body-1: mat.m2-define-typography-level(15px, 24px, 400),
$subtitle-2: mat.m2-define-typography-level(14px, 24px, 500),
$body-2: mat.m2-define-typography-level(14px, 20px, 400),
$caption: mat.m2-define-typography-level(12px, 20px, 400),
$button: mat.m2-define-typography-level(14px, 14px, 500),
// Line-height must be unit-less fraction of the font-size.
);
@if $base-font-size {
$custom-typography: mat.define-legacy-typography-configmat.define-typography-config(
$headline-1: mat.define-typography-level(8rem, 8rem, 300),
$headline-2: mat.define-typography-level(4rem, 4rem, 400),
$headline-3: mat.define-typography-level(3.21rem, 3.21rem, 400),
$headline-4: mat.define-typography-level(2.42rem, 2.85rem, 400),
$headline-5: mat.define-typography-level(1.71rem, 2.28rem, 400),
$headline-6: mat.define-typography-level(1.42rem, 2.28rem, 500),
$subtitle-1: mat.define-typography-level(1.14rem, 2rem, 400),
$body-1: mat.define-typography-level(1.07rem, 1.71rem, 400),
$subtitle-2: mat.define-typography-level(1rem, 1.71rem, 500),
$body-2: mat.define-typography-level(1rem, 1.42rem, 400),
$caption: mat.define-typography-level(0.86rem, 1.42rem, 400),
$button: mat.define-typography-level(1rem, 1rem, 500),
$custom-typography: mat.define-legacy-typography-configmat.m2-define-typography-config(
$headline-1: mat.m2-define-typography-level(8rem, 8rem, 300),
$headline-2: mat.m2-define-typography-level(4rem, 4rem, 400),
$headline-3: mat.m2-define-typography-level(3.21rem, 3.21rem, 400),
$headline-4: mat.m2-define-typography-level(2.42rem, 2.85rem, 400),
$headline-5: mat.m2-define-typography-level(1.71rem, 2.28rem, 400),
$headline-6: mat.m2-define-typography-level(1.42rem, 2.28rem, 500),
$subtitle-1: mat.m2-define-typography-level(1.14rem, 2rem, 400),
$body-1: mat.m2-define-typography-level(1.07rem, 1.71rem, 400),
$subtitle-2: mat.m2-define-typography-level(1rem, 1.71rem, 500),
$body-2: mat.m2-define-typography-level(1rem, 1.42rem, 400),
$caption: mat.m2-define-typography-level(0.86rem, 1.42rem, 400),
$button: mat.m2-define-typography-level(1rem, 1rem, 500),
$font-family: $default-font-family,
);
}
@if $font-family {
@each $key, $level in $custom-typography {
@if type-of($level) == 'map' {
@if meta.type-of($level) == 'map' {
$new-level: map.merge(
$level,
(

View File

@@ -24,7 +24,7 @@ import { of, Subject } from 'rxjs';
import { ExtensionsModule } from '@alfresco/adf-extensions';
import { CommonModule } from '@angular/common';
import { ShellAppService, SHELL_APP_SERVICE } from '../../services/shell-app.service';
import { HttpClientModule } from '@angular/common/http';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { TranslateModule } from '@ngx-translate/core';
@@ -58,28 +58,26 @@ describe('AppLayoutComponent', () => {
};
TestBed.configureTestingModule({
imports: [
CommonModule,
NoopAnimationsModule,
HttpClientModule,
...LAYOUT_DIRECTIVES,
ExtensionsModule,
RouterModule.forChild([]),
TranslateModule.forRoot(),
ShellLayoutComponent
],
providers: [
{
provide: Router,
useClass: MockRouter
},
{
provide: SHELL_APP_SERVICE,
useValue: shellService
}
],
schemas: [NO_ERRORS_SCHEMA]
});
schemas: [NO_ERRORS_SCHEMA],
imports: [CommonModule,
NoopAnimationsModule,
...LAYOUT_DIRECTIVES,
ExtensionsModule,
RouterModule.forChild([]),
TranslateModule.forRoot(),
ShellLayoutComponent],
providers: [
{
provide: Router,
useClass: MockRouter
},
{
provide: SHELL_APP_SERVICE,
useValue: shellService
},
provideHttpClient(withInterceptorsFromDi())
]
});
fixture = TestBed.createComponent(ShellLayoutComponent);
component = fixture.componentInstance;

View File

@@ -19,8 +19,9 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AboutServerSettingsComponent } from './about-server-settings.component';
import { AppConfigService } from '../../app-config/app-config.service';
import { TranslateModule } from '@ngx-translate/core';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { AppConfigServiceMock } from '../../common';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
const aboutGithubDetails = {
url: 'https://github.com/componany/repository/commits/',
@@ -38,9 +39,9 @@ describe('AboutServerSettingsComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), HttpClientTestingModule],
providers: [{ provide: AppConfigService, useClass: AppConfigServiceMock }]
});
imports: [TranslateModule.forRoot()],
providers: [{ provide: AppConfigService, useClass: AppConfigServiceMock }, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
});
fixture = TestBed.createComponent(AboutServerSettingsComponent);
component = fixture.componentInstance;
appConfigService = TestBed.inject(AppConfigService);

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { HttpClient, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { TestBed } from '@angular/core/testing';
import { AppConfigService } from './app-config.service';
import { ExtensionConfig, ExtensionService } from '@alfresco/adf-extensions';
@@ -49,9 +49,9 @@ describe('AppConfigService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientModule],
providers: [{ provide: ExtensionService, useClass: TestExtensionService }]
});
imports: [],
providers: [{ provide: ExtensionService, useClass: TestExtensionService }, provideHttpClient(withInterceptorsFromDi())]
});
});
beforeEach(() => {

View File

@@ -17,10 +17,7 @@
import { throwError as observableThrowError, Observable } from 'rxjs';
import { Injectable } from '@angular/core';
import {
HttpHandler, HttpInterceptor, HttpRequest,
HttpSentEvent, HttpHeaderResponse, HttpProgressEvent, HttpResponse, HttpUserEvent, HttpHeaders
} from '@angular/common/http';
import { HttpHandler, HttpInterceptor, HttpRequest, HttpSentEvent, HttpHeaderResponse, HttpProgressEvent, HttpResponse, HttpUserEvent, HttpHeaders } from '@angular/common/http';
import { catchError, mergeMap } from 'rxjs/operators';
import { AuthenticationService } from '../services/authentication.service';

View File

@@ -23,10 +23,11 @@ import { RouterStateSnapshot, Router } from '@angular/router';
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
import { TranslateModule } from '@ngx-translate/core';
import { BasicAlfrescoAuthService } from '../basic-auth/basic-alfresco-auth.service';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { RedirectAuthService } from '../oidc/redirect-auth.service';
import { EMPTY, of } from 'rxjs';
import { OidcAuthenticationService } from '../oidc/oidc-authentication.service';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
describe('AuthGuardService BPM', () => {
let authGuard: AuthGuardBpm;
@@ -39,20 +40,22 @@ describe('AuthGuardService BPM', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), HttpClientTestingModule, MatDialogModule],
providers: [
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY, onTokenReceived: of() } },
{
provide: OidcAuthenticationService,
useValue: {
ssoLogin: () => {},
isPublicUrl: () => false,
hasValidIdToken: () => false,
isLoggedIn: () => false
}
}
]
});
imports: [TranslateModule.forRoot(), MatDialogModule],
providers: [
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY, onTokenReceived: of() } },
{
provide: OidcAuthenticationService,
useValue: {
ssoLogin: () => { },
isPublicUrl: () => false,
hasValidIdToken: () => false,
isLoggedIn: () => false
}
},
provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting()
]
});
localStorage.clear();
basicAlfrescoAuthService = TestBed.inject(BasicAlfrescoAuthService);
oidcAuthenticationService = TestBed.inject(OidcAuthenticationService);

View File

@@ -23,11 +23,12 @@ import { RouterStateSnapshot, Router } from '@angular/router';
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
import { TranslateModule } from '@ngx-translate/core';
import { BasicAlfrescoAuthService } from '../basic-auth/basic-alfresco-auth.service';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { RedirectAuthService } from '../oidc/redirect-auth.service';
import { EMPTY, of } from 'rxjs';
import { OidcAuthenticationService } from '../oidc/oidc-authentication.service';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
describe('AuthGuardService ECM', () => {
let authGuard: AuthGuardEcm;
@@ -39,22 +40,24 @@ describe('AuthGuardService ECM', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), HttpClientTestingModule, RouterTestingModule, MatDialogModule],
providers: [
BasicAlfrescoAuthService,
AppConfigService,
{
provide: OidcAuthenticationService,
useValue: {
ssoLogin: () => {},
isPublicUrl: () => false,
hasValidIdToken: () => false,
isLoggedIn: () => false
}
},
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY, onTokenReceived: of() } }
]
});
imports: [TranslateModule.forRoot(), RouterTestingModule, MatDialogModule],
providers: [
BasicAlfrescoAuthService,
AppConfigService,
{
provide: OidcAuthenticationService,
useValue: {
ssoLogin: () => { },
isPublicUrl: () => false,
hasValidIdToken: () => false,
isLoggedIn: () => false
}
},
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY, onTokenReceived: of() } },
provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting()
]
});
localStorage.clear();
oidcAuthenticationService = TestBed.inject(OidcAuthenticationService);
basicAlfrescoAuthService = TestBed.inject(BasicAlfrescoAuthService);

View File

@@ -21,7 +21,8 @@ import { AuthGuardSsoRoleService } from './auth-guard-sso-role.service';
import { JwtHelperService } from '../services/jwt-helper.service';
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
import { TranslateModule } from '@ngx-translate/core';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
describe('Auth Guard SSO role service', () => {
let authGuard: AuthGuardSsoRoleService;
@@ -30,8 +31,9 @@ describe('Auth Guard SSO role service', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), HttpClientTestingModule, MatDialogModule]
});
imports: [TranslateModule.forRoot(), MatDialogModule],
providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
});
localStorage.clear();
authGuard = TestBed.inject(AuthGuardSsoRoleService);
jwtHelperService = TestBed.inject(JwtHelperService);

View File

@@ -26,9 +26,10 @@ import { OidcAuthenticationService } from '../oidc/oidc-authentication.service';
import { BasicAlfrescoAuthService } from '../basic-auth/basic-alfresco-auth.service';
import { RedirectAuthService } from '../oidc/redirect-auth.service';
import { EMPTY, of } from 'rxjs';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { MatDialogModule } from '@angular/material/dialog';
import { RouterTestingModule } from '@angular/router/testing';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
describe('AuthGuardService', () => {
let state;
@@ -42,21 +43,23 @@ describe('AuthGuardService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), HttpClientTestingModule, MatDialogModule, RouterTestingModule],
providers: [
AppConfigService,
StorageService,
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY, onTokenReceived: of() } },
{
provide: OidcAuthenticationService,
useValue: {
ssoLogin: () => {},
isPublicUrl: () => false,
hasValidIdToken: () => false
}
}
]
});
imports: [TranslateModule.forRoot(), MatDialogModule, RouterTestingModule],
providers: [
AppConfigService,
StorageService,
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY, onTokenReceived: of() } },
{
provide: OidcAuthenticationService,
useValue: {
ssoLogin: () => { },
isPublicUrl: () => false,
hasValidIdToken: () => false
}
},
provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting()
]
});
localStorage.clear();
state = { url: '' };
authService = TestBed.inject(AuthenticationService);

View File

@@ -15,13 +15,14 @@
* limitations under the License.
*/
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';
import { EMPTY } from 'rxjs';
import { AppConfigService } from '../../app-config/app-config.service';
import { AUTH_MODULE_CONFIG } from './auth-config';
import { AuthConfigService } from './auth-config.service';
import { OauthConfigModel } from '../models/oauth-config.model';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
describe('AuthConfigService', () => {
let service: AuthConfigService;
@@ -115,11 +116,13 @@ describe('AuthConfigService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
providers: [
{ provide: AUTH_MODULE_CONFIG, useValue: { useHash: true } }
]
});
imports: [],
providers: [
{ provide: AUTH_MODULE_CONFIG, useValue: { useHash: true } },
provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting()
]
});
service = TestBed.inject(AuthConfigService);
spyOn<any>(service, 'getLocationOrigin').and.returnValue('http://localhost:3000');

View File

@@ -22,7 +22,7 @@ import { AppConfigService } from '../../app-config/app-config.service';
import { TranslateModule } from '@ngx-translate/core';
import { BasicAlfrescoAuthService } from '../basic-auth/basic-alfresco-auth.service';
import { AuthModule } from '../oidc/auth.module';
import { HttpClientModule } from '@angular/common/http';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { CookieServiceMock } from '../../mock';
import { AppConfigServiceMock } from '../../common';
import { OidcAuthenticationService } from '../oidc/oidc-authentication.service';
@@ -42,18 +42,19 @@ xdescribe('AuthenticationService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), AuthModule.forRoot({ useHash: true }), HttpClientModule],
providers: [
{
provide: CookieService,
useClass: CookieServiceMock
},
{
provide: AppConfigService,
useClass: AppConfigServiceMock
}
]
});
imports: [TranslateModule.forRoot(), AuthModule.forRoot({ useHash: true })],
providers: [
{
provide: CookieService,
useClass: CookieServiceMock
},
{
provide: AppConfigService,
useClass: AppConfigServiceMock
},
provideHttpClient(withInterceptorsFromDi())
]
});
sessionStorage.clear();
localStorage.clear();

View File

@@ -17,7 +17,7 @@
import { fakeAsync, TestBed } from '@angular/core/testing';
import { IdentityGroupService } from './identity-group.service';
import { HttpErrorResponse } from '@angular/common/http';
import { HttpErrorResponse, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { throwError, of } from 'rxjs';
import {
mockIdentityRoles,
@@ -29,7 +29,7 @@ import {
} from '../mock/identity-group.mock';
import { TranslateModule } from '@ngx-translate/core';
import { AdfHttpClient } from '../../../../api/src';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
describe('IdentityGroupService', () => {
let service: IdentityGroupService;
@@ -38,9 +38,9 @@ describe('IdentityGroupService', () => {
beforeEach(fakeAsync(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), HttpClientTestingModule],
providers: [AdfHttpClient]
});
imports: [TranslateModule.forRoot()],
providers: [AdfHttpClient, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
});
service = TestBed.inject(IdentityGroupService);
adfHttpClient = TestBed.inject(AdfHttpClient);
requestSpy = spyOn(adfHttpClient, 'request');

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { HttpClientModule, HttpErrorResponse, HttpResponse } from '@angular/common/http';
import { HttpErrorResponse, HttpResponse, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { TestBed } from '@angular/core/testing';
import { of, throwError } from 'rxjs';
import { IdentityRoleResponseModel, IdentityRoleService } from './identity-role.service';
@@ -50,10 +50,9 @@ describe('IdentityRoleService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
HttpClientModule
]
});
imports: [],
providers: [provideHttpClient(withInterceptorsFromDi())]
});
service = TestBed.inject(IdentityRoleService);
});

View File

@@ -16,7 +16,7 @@
*/
import { TestBed } from '@angular/core/testing';
import { HttpErrorResponse } from '@angular/common/http';
import { HttpErrorResponse, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { throwError, of } from 'rxjs';
import {
mockIdentityUser1,
@@ -35,7 +35,7 @@ import { IdentityRoleModel } from '../models/identity-role.model';
import { TranslateModule } from '@ngx-translate/core';
import { AdfHttpClient } from '../../../../api/src';
import { StorageService } from '../../common/services/storage.service';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
describe('IdentityUserService', () => {
const mockRoles = [
@@ -53,9 +53,9 @@ describe('IdentityUserService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), HttpClientTestingModule],
providers: [StorageService, AdfHttpClient]
});
imports: [TranslateModule.forRoot()],
providers: [StorageService, AdfHttpClient, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
});
storageService = TestBed.inject(StorageService);
service = TestBed.inject(IdentityUserService);
adfHttpClient = TestBed.inject(AdfHttpClient);

View File

@@ -19,7 +19,8 @@ import { TestBed } from '@angular/core/testing';
import { UserAccessService } from './user-access.service';
import { JwtHelperService } from './jwt-helper.service';
import { AppConfigService } from '../../app-config';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
describe('UserAccessService', () => {
let userAccessService: UserAccessService;
@@ -28,9 +29,9 @@ describe('UserAccessService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
providers: [UserAccessService]
});
imports: [],
providers: [UserAccessService, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
});
userAccessService = TestBed.inject(UserAccessService);
jwtHelperService = TestBed.inject(JwtHelperService);
appConfigService = TestBed.inject(AppConfigService);

View File

@@ -20,11 +20,12 @@ import { ComponentFixture, TestBed, tick, fakeAsync } from '@angular/core/testin
import { ClipboardService } from './clipboard.service';
import { ClipboardDirective } from './clipboard.directive';
import { TranslateModule } from '@ngx-translate/core';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { TranslationService } from '../translation';
import { TranslationMock } from '../mock';
import { MatButtonModule } from '@angular/material/button';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
@Component({
selector: 'adf-test-component',
@@ -42,10 +43,10 @@ describe('ClipboardDirective', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), HttpClientTestingModule, MatSnackBarModule, MatButtonModule, ClipboardDirective],
providers: [ClipboardService, { provide: TranslationService, useClass: TranslationMock }],
declarations: [TestTargetClipboardComponent]
});
declarations: [TestTargetClipboardComponent],
imports: [TranslateModule.forRoot(), MatSnackBarModule, MatButtonModule, ClipboardDirective],
providers: [ClipboardService, { provide: TranslationService, useClass: TranslationMock }, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
});
fixture = TestBed.createComponent(TestTargetClipboardComponent);
clipboardService = TestBed.inject(ClipboardService);
fixture.detectChanges();
@@ -86,10 +87,10 @@ describe('CopyClipboardDirective', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), HttpClientTestingModule, MatSnackBarModule, ClipboardDirective],
providers: [ClipboardService, { provide: TranslationService, useClass: TranslationMock }],
declarations: [TestCopyClipboardComponent]
});
declarations: [TestCopyClipboardComponent],
imports: [TranslateModule.forRoot(), MatSnackBarModule, ClipboardDirective],
providers: [ClipboardService, { provide: TranslationService, useClass: TranslationMock }, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
});
fixture = TestBed.createComponent(TestCopyClipboardComponent);
element = fixture.debugElement.nativeElement;
fixture.detectChanges();

View File

@@ -20,9 +20,10 @@ import { TestBed } from '@angular/core/testing';
import { ClipboardService } from './clipboard.service';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { TranslateModule } from '@ngx-translate/core';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { TranslationService } from '../translation';
import { TranslationMock } from '../mock';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
describe('ClipboardService', () => {
let clipboardService: ClipboardService;
@@ -31,9 +32,9 @@ describe('ClipboardService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), HttpClientTestingModule, MatSnackBarModule],
providers: [ClipboardService, { provide: TranslationService, useClass: TranslationMock }]
});
imports: [TranslateModule.forRoot(), MatSnackBarModule],
providers: [ClipboardService, { provide: TranslationService, useClass: TranslationMock }, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
});
clipboardService = TestBed.inject(ClipboardService);
notificationService = TestBed.inject(NotificationService);
inputElement = document.createElement('input');

View File

@@ -23,7 +23,8 @@ import { TranslateModule } from '@ngx-translate/core';
import { commentUserNoPictureDefined, commentUserPictureDefined, mockCommentOne, testUser } from './mocks/comment-list.mock';
import { CommentListServiceMock } from './mocks/comment-list.service.mock';
import { ADF_COMMENTS_SERVICE } from '../interfaces/comments.token';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
describe('CommentListComponent', () => {
let commentList: CommentListComponent;
@@ -32,14 +33,16 @@ describe('CommentListComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), HttpClientTestingModule],
providers: [
{
provide: ADF_COMMENTS_SERVICE,
useClass: CommentListServiceMock
}
]
});
imports: [TranslateModule.forRoot()],
providers: [
{
provide: ADF_COMMENTS_SERVICE,
useClass: CommentListServiceMock
},
provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting()
]
});
fixture = TestBed.createComponent(CommentListComponent);
commentList = fixture.componentInstance;

View File

@@ -24,7 +24,8 @@ import { of, throwError } from 'rxjs';
import { ADF_COMMENTS_SERVICE } from './interfaces/comments.token';
import { CommentsService } from './interfaces/comments-service.interface';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
describe('CommentsComponent', () => {
let component: CommentsComponent;
@@ -35,14 +36,16 @@ describe('CommentsComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [NoopAnimationsModule, HttpClientTestingModule, TranslateModule.forRoot(), CommentsComponent],
providers: [
{
provide: ADF_COMMENTS_SERVICE,
useClass: CommentsServiceMock
}
]
});
imports: [NoopAnimationsModule, TranslateModule.forRoot(), CommentsComponent],
providers: [
{
provide: ADF_COMMENTS_SERVICE,
useClass: CommentsServiceMock
},
provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting()
]
});
fixture = TestBed.createComponent(CommentsComponent);
component = fixture.componentInstance;

View File

@@ -18,27 +18,30 @@
import { TestBed } from '@angular/core/testing';
import { UserPreferencesService } from './user-preferences.service';
import { TranslateModule } from '@ngx-translate/core';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { DirectionalityConfigService } from './directionality-config.service';
import { directionalityConfigFactory } from './directionality-config-factory';
import { APP_INITIALIZER } from '@angular/core';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
describe('DirectionalityConfigService', () => {
let userPreferencesService: UserPreferencesService;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), HttpClientTestingModule],
providers: [
UserPreferencesService,
{
provide: APP_INITIALIZER,
useFactory: directionalityConfigFactory,
deps: [DirectionalityConfigService],
multi: true
}
]
});
imports: [TranslateModule.forRoot()],
providers: [
UserPreferencesService,
{
provide: APP_INITIALIZER,
useFactory: directionalityConfigFactory,
deps: [DirectionalityConfigService],
multi: true
},
provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting()
]
});
userPreferencesService = TestBed.inject(UserPreferencesService);
});

View File

@@ -17,7 +17,7 @@
/* eslint-disable no-console */
import { HttpClientModule } from '@angular/common/http';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { Component } from '@angular/core';
import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing';
import { AppConfigService } from '../../app-config/app-config.service';
@@ -61,10 +61,10 @@ describe('LogService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientModule],
declarations: [ProvidesLogComponent],
providers: [LogService, AppConfigService]
});
declarations: [ProvidesLogComponent],
imports: [],
providers: [LogService, AppConfigService, provideHttpClient(withInterceptorsFromDi())]
});
appConfigService = TestBed.inject(AppConfigService);
providesLogComponent = TestBed.createComponent(ProvidesLogComponent);
});

View File

@@ -23,8 +23,9 @@ import { UserPreferencesService, UserPreferenceValues } from '../../common/servi
import { AppConfigServiceMock } from '../mock/app-config.service.mock';
import { AlfrescoApiService } from '../../services/alfresco-api.service';
import { AlfrescoApiServiceMock, TranslationMock } from '../../mock';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { TranslationService } from '../../translation';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
describe('UserPreferencesService', () => {
const supportedPaginationSize = [5, 10, 15, 20];
@@ -36,15 +37,17 @@ describe('UserPreferencesService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), HttpClientTestingModule],
providers: [
UserPreferencesService,
StorageService,
{ provide: TranslationService, useClass: TranslationMock },
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
{ provide: AppConfigService, useClass: AppConfigServiceMock }
]
});
imports: [TranslateModule.forRoot()],
providers: [
UserPreferencesService,
StorageService,
{ provide: TranslationService, useClass: TranslationMock },
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
{ provide: AppConfigService, useClass: AppConfigServiceMock },
provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting()
]
});
appConfig = TestBed.inject(AppConfigService);
appConfig.config = {
pagination: {

View File

@@ -44,7 +44,7 @@ import { DirectionalityConfigService } from './common/services/directionality-co
import { SEARCH_TEXT_INPUT_DIRECTIVES } from './search-text/search-text-input.module';
import { AdfHttpClient } from '@alfresco/adf-core/api';
import { AuthenticationInterceptor, Authentication } from '@alfresco/adf-core/auth';
import { HttpClientModule, HttpClientXsrfModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi, withXsrfConfiguration } from '@angular/common/http';
import { AuthenticationService } from './auth/services/authentication.service';
import { MAT_SNACK_BAR_DEFAULT_OPTIONS } from '@angular/material/snack-bar';
import { loadAppConfig } from './app-config/app-config.loader';
@@ -62,9 +62,37 @@ import { IdentityUserInfoComponent } from './identity-user-info';
import { UnsavedChangesDialogComponent } from './dialogs';
import { MaterialModule } from './material.module';
@NgModule({
imports: [
@NgModule({ exports: [
...ABOUT_DIRECTIVES,
...VIEWER_DIRECTIVES,
...LAYOUT_DIRECTIVES,
...CORE_PIPES,
...CORE_DIRECTIVES,
...CLIPBOARD_DIRECTIVES,
IdentityUserInfoComponent,
AppConfigPipe,
...PAGINATION_DIRECTIVES,
...TOOLBAR_DIRECTIVES,
...CONTEXT_MENU_DIRECTIVES,
...CARD_VIEW_DIRECTIVES,
FormBaseModule,
CommentsComponent,
CommentListComponent,
...LOGIN_DIRECTIVES,
...LANGUAGE_MENU_DIRECTIVES,
...INFO_DRAWER_DIRECTIVES,
...DATATABLE_DIRECTIVES,
TranslateModule,
...TEMPLATE_DIRECTIVES,
SortingPickerComponent,
IconComponent,
...NOTIFICATION_HISTORY_DIRECTIVES,
...SEARCH_TEXT_INPUT_DIRECTIVES,
BlankPageComponent,
UnsavedChangesDialogComponent,
DynamicChipListComponent,
MaterialModule
], imports: [TranslateModule,
...ABOUT_DIRECTIVES,
...VIEWER_DIRECTIVES,
...LAYOUT_DIRECTIVES,
@@ -92,45 +120,10 @@ import { MaterialModule } from './material.module';
BlankPageComponent,
UnsavedChangesDialogComponent,
DynamicChipListComponent,
HttpClientModule,
HttpClientXsrfModule.withOptions({
MaterialModule], providers: [provideHttpClient(withInterceptorsFromDi(), withXsrfConfiguration({
cookieName: 'CSRF-TOKEN',
headerName: 'X-CSRF-TOKEN'
}),
MaterialModule
],
exports: [
...ABOUT_DIRECTIVES,
...VIEWER_DIRECTIVES,
...LAYOUT_DIRECTIVES,
...CORE_PIPES,
...CORE_DIRECTIVES,
...CLIPBOARD_DIRECTIVES,
IdentityUserInfoComponent,
AppConfigPipe,
...PAGINATION_DIRECTIVES,
...TOOLBAR_DIRECTIVES,
...CONTEXT_MENU_DIRECTIVES,
...CARD_VIEW_DIRECTIVES,
FormBaseModule,
CommentsComponent,
CommentListComponent,
...LOGIN_DIRECTIVES,
...LANGUAGE_MENU_DIRECTIVES,
...INFO_DRAWER_DIRECTIVES,
...DATATABLE_DIRECTIVES,
TranslateModule,
...TEMPLATE_DIRECTIVES,
SortingPickerComponent,
IconComponent,
...NOTIFICATION_HISTORY_DIRECTIVES,
...SEARCH_TEXT_INPUT_DIRECTIVES,
BlankPageComponent,
UnsavedChangesDialogComponent,
DynamicChipListComponent,
MaterialModule
]
})
}))] })
export class CoreModule {
static forRoot(): ModuleWithProviders<CoreModule> {
return {

View File

@@ -20,11 +20,12 @@ import { DateCellComponent } from './date-cell.component';
import { DataColumn, DateConfig } from '../../data/data-column.model';
import { BehaviorSubject } from 'rxjs';
import { AppConfigService } from '../../../app-config';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { TranslateModule } from '@ngx-translate/core';
import { LOCALE_ID } from '@angular/core';
import { registerLocaleData } from '@angular/common';
import localePL from '@angular/common/locales/pl';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
let component: DateCellComponent;
let appConfigService: AppConfigService;
@@ -62,13 +63,10 @@ const checkDisplayedTooltip = (expectedTooltip: string) => {
const configureTestingModule = (providers: any[]) => {
TestBed.configureTestingModule({
imports: [
DateCellComponent,
HttpClientTestingModule,
TranslateModule.forRoot()
],
providers
});
imports: [DateCellComponent,
TranslateModule.forRoot()],
providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
});
fixture = TestBed.createComponent(DateCellComponent);
component = fixture.componentInstance;

View File

@@ -29,7 +29,8 @@ import { MatDialogModule } from '@angular/material/dialog';
import { MatDatetimepickerModule, MatNativeDatetimeModule } from '@mat-datetimepicker/core';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
describe('DateTimeWidgetComponent', () => {
let loader: HarnessLoader;
@@ -40,17 +41,15 @@ describe('DateTimeWidgetComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
TranslateModule.forRoot(),
HttpClientTestingModule,
NoopAnimationsModule,
MatDialogModule,
MatNativeDatetimeModule,
MatDatepickerModule,
MatDatetimepickerModule,
DateTimeWidgetComponent
]
});
imports: [TranslateModule.forRoot(),
NoopAnimationsModule,
MatDialogModule,
MatNativeDatetimeModule,
MatDatepickerModule,
MatDatetimepickerModule,
DateTimeWidgetComponent],
providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
});
fixture = TestBed.createComponent(DateTimeWidgetComponent);
element = fixture.nativeElement;

View File

@@ -25,7 +25,7 @@ import { HarnessLoader } from '@angular/cdk/testing';
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
import { MatIconHarness } from '@angular/material/icon/testing';
import {MatSnackBarHarness} from '@angular/material/snack-bar/testing';
import { HttpClientModule } from '@angular/common/http';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { TranslationMock } from '../../mock';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
@@ -94,11 +94,13 @@ describe('NotificationService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), NoopAnimationsModule, HttpClientModule, MatSnackBarModule],
declarations: [ProvidesNotificationServiceComponent],
providers:[
{ provide: TranslationService, useClass: TranslationMock }]
});
declarations: [ProvidesNotificationServiceComponent],
imports: [TranslateModule.forRoot(), NoopAnimationsModule, MatSnackBarModule],
providers: [
{ provide: TranslationService, useClass: TranslationMock },
provideHttpClient(withInterceptorsFromDi())
]
});
translationService = TestBed.inject(TranslationService);
fixture = TestBed.createComponent(ProvidesNotificationServiceComponent);
fixture.detectChanges();

View File

@@ -24,7 +24,7 @@ import { PaginationModel } from '../models/pagination.model';
import { TranslationService } from '../translation/translation.service';
import { TranslationMock } from '../mock/translation.service.mock';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { HttpClientModule } from '@angular/common/http';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { MatMenuModule } from '@angular/material/menu';
class FakePaginationInput implements PaginationModel {
@@ -46,18 +46,16 @@ describe('PaginationComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
NoopAnimationsModule,
HttpClientModule,
MatMenuModule,
TranslateModule.forRoot({
loader: {provide: TranslateLoader, useClass: TranslateFakeLoader}
})
],
providers:[
{ provide: TranslationService, useClass: TranslationMock }
]
});
imports: [NoopAnimationsModule,
MatMenuModule,
TranslateModule.forRoot({
loader: { provide: TranslateLoader, useClass: TranslateFakeLoader }
})],
providers: [
{ provide: TranslationService, useClass: TranslationMock },
provideHttpClient(withInterceptorsFromDi())
]
});
fixture = TestBed.createComponent(PaginationComponent);
component = fixture.componentInstance;
fixture.detectChanges();

View File

@@ -11,59 +11,59 @@
$background: map-get($theme, background);
$defaults: (
--adf-card-view-background: mat.get-color-from-palette($background, card),
--adf-card-view-background: mat.m2-get-color-from-palette($background, card),
--adf-card-view-border: $adf-ref-card-border,
--adf-card-view-border-color: mat.get-color-from-palette($foreground, divider),
--adf-card-view-border-color: mat.m2-get-color-from-palette($foreground, divider),
--adf-card-view-border-radius: $adf-ref-card-border-radius-slim,
--adf-card-view-array-item-background: mat.get-color-from-palette($background, card),
--adf-card-view-array-item-background: mat.m2-get-color-from-palette($background, card),
--adf-card-view-array-item-border: $adf-ref-card-border,
--adf-card-view-array-item-border-color: mat.get-color-from-palette($foreground, divider),
--adf-card-view-array-item-border-color: mat.m2-get-color-from-palette($foreground, divider),
--adf-card-view-array-item-border-radius: $adf-ref-card-border-radius-slim,
--adf-edit-task-and-service-filter-header-title-color: mat.get-color-from-palette($foreground, text),
--adf-edit-task-and-service-filter-header-description-color: mat.get-color-from-palette($foreground, secondary-text),
--adf-edit-task-and-service-filter-content-text-label-color: mat.get-color-from-palette($foreground, secondary-text),
--adf-edit-task-and-service-filter-content-select-label-color: mat.get-color-from-palette($foreground, secondary-text),
--adf-edit-task-and-service-filter-header-title-color: mat.m2-get-color-from-palette($foreground, text),
--adf-edit-task-and-service-filter-header-description-color: mat.m2-get-color-from-palette($foreground, secondary-text),
--adf-edit-task-and-service-filter-content-text-label-color: mat.m2-get-color-from-palette($foreground, secondary-text),
--adf-edit-task-and-service-filter-content-select-label-color: mat.m2-get-color-from-palette($foreground, secondary-text),
--adf-edit-task-and-service-filter-header-height: $adf-ref-height-48,
--adf-about-panel-header-height: $adf-ref-height-48,
--adf-about-panel-header-title-color: mat.get-color-from-palette($foreground, text),
--adf-about-panel-header-title-color: mat.m2-get-color-from-palette($foreground, text),
--adf-edit-process-filter-header-height: $adf-ref-height-48,
--adf-edit-process-filter-header-title-color: mat.get-color-from-palette($foreground, text),
--adf-edit-process-filter-header-description-color: mat.get-color-from-palette($foreground, secondary-text),
--adf-edit-process-filter-content-text-label-color: mat.get-color-from-palette($foreground, secondary-text),
--adf-edit-process-filter-content-select-label-color: mat.get-color-from-palette($foreground, secondary-text),
--adf-about-server-settings-background: mat.get-color-from-palette($background, card),
--adf-about-server-settings-color: mat.get-color-from-palette($foreground, text),
--adf-edit-process-filter-header-title-color: mat.m2-get-color-from-palette($foreground, text),
--adf-edit-process-filter-header-description-color: mat.m2-get-color-from-palette($foreground, secondary-text),
--adf-edit-process-filter-content-text-label-color: mat.m2-get-color-from-palette($foreground, secondary-text),
--adf-edit-process-filter-content-select-label-color: mat.m2-get-color-from-palette($foreground, secondary-text),
--adf-about-server-settings-background: mat.m2-get-color-from-palette($background, card),
--adf-about-server-settings-color: mat.m2-get-color-from-palette($foreground, text),
--adf-about-server-settings-border-radius: $adf-ref-card-border-radius-normal,
--adf-about-server-settings-padding: $adf-ref-card-padding,
--adf-package-list-table-background: mat.get-color-from-palette($background, card),
--adf-package-list-table-background: mat.m2-get-color-from-palette($background, card),
--adf-package-list-table-header-min-height: $adf-ref-table-header-min-height,
--adf-package-list-table-header-cell-color: mat.get-color-from-palette($foreground, secondary-text),
--adf-package-list-table-header-cell-color: mat.m2-get-color-from-palette($foreground, secondary-text),
--adf-package-list-table-row-min-height: $adf-ref-table-row-min-height,
--adf-package-list-table-row-cell-color: mat.get-color-from-palette($foreground, text),
--adf-package-list-table-row-cell-color: mat.m2-get-color-from-palette($foreground, text),
--adf-identity-user-info-background: var(--adf-theme-primary-300),
--adf-identity-user-info-height: $adf-ref-height,
--adf-identity-user-info-width: $adf-ref-width,
--adf-identity-user-info-line-height: $adf-ref-line-height,
--adf-identity-user-info-font-size: var(--theme-adf-picture-1-font-size),
--adf-user-info-container-margin-right: $adf-ref-margin-right,
--adf-info-drawer-tab-default-color: mat.get-color-from-palette($accent),
--adf-info-drawer-tab-default-background: mat.get-color-from-palette($background, card),
--adf-info-drawer-tab-default-color: mat.m2-get-color-from-palette($accent),
--adf-info-drawer-tab-default-background: mat.m2-get-color-from-palette($background, card),
--adf-info-drawer-tab-default-bottom-line: $adf-ref-tab-bottom-line-default,
--adf-info-drawer-tab-hover-color: mat.get-color-from-palette($accent),
--adf-info-drawer-tab-hover-background: mat.get-color-from-palette($background, card),
--adf-info-drawer-tab-hover-color: mat.m2-get-color-from-palette($accent),
--adf-info-drawer-tab-hover-background: mat.m2-get-color-from-palette($background, card),
--adf-info-drawer-tab-hover-bottom-line: $adf-ref-tab-bottom-line-default,
--adf-info-drawer-tab-active-unfocused-color: mat.get-color-from-palette($primary),
--adf-info-drawer-tab-active-unfocused-background: mat.get-color-from-palette($background, card),
--adf-info-drawer-tab-active-unfocused-color: mat.m2-get-color-from-palette($primary),
--adf-info-drawer-tab-active-unfocused-background: mat.m2-get-color-from-palette($background, card),
--adf-info-drawer-tab-active-unfocused-bottom-line: $adf-ref-tab-bottom-line-default,
--adf-info-drawer-tab-active-focused-color: mat.get-color-from-palette($foreground, text),
--adf-info-drawer-tab-active-focused-background: mat.get-color-from-palette($primary),
--adf-info-drawer-tab-active-focused-color: mat.m2-get-color-from-palette($foreground, text),
--adf-info-drawer-tab-active-focused-background: mat.m2-get-color-from-palette($primary),
--adf-info-drawer-tab-active-focused-bottom-line: $adf-ref-tab-bottom-line-active,
--adf-people-cloud-input-label-default-color: mat.get-color-from-palette($foreground, secondary-text),
--adf-people-cloud-input-label-focus-color: mat.get-color-from-palette($primary),
--adf-people-cloud-autosuggest-result-active-color: mat.get-color-from-palette($foreground, text),
--adf-people-cloud-autosuggest-result-disabled-color: mat.get-color-from-palette($foreground, secondary-text),
--adf-people-cloud-input-caption-error-color: mat.get-color-from-palette($warn),
--adf-people-cloud-input-label-default-color: mat.m2-get-color-from-palette($foreground, secondary-text),
--adf-people-cloud-input-label-focus-color: mat.m2-get-color-from-palette($primary),
--adf-people-cloud-autosuggest-result-active-color: mat.m2-get-color-from-palette($foreground, text),
--adf-people-cloud-autosuggest-result-disabled-color: mat.m2-get-color-from-palette($foreground, secondary-text),
--adf-people-cloud-input-caption-error-color: mat.m2-get-color-from-palette($warn),
--adf-metadata-property-panel-border-color: $adf-ref-metadata-property-panel-border-color,
--adf-metadata-buttons-background-color: $adf-ref-metadata-buttons-background-color,
--adf-metadata-action-button-clear-color: $adf-ref-metadata-action-button-clear-color,
@@ -71,16 +71,16 @@
--adf-metadata-property-panel-label-color: $adf-ref-metadata-property-panel-label-color,
--adf-metadata-property-panel-title-color: $adf-ref-metadata-property-panel-title-color,
--adf-group-cloud-input-label-default-color: mat.get-color-from-palette($foreground, secondary-text),
--adf-group-cloud-input-label-focus-color: mat.get-color-from-palette($primary),
--adf-group-cloud-autosuggest-result-active-color: mat.get-color-from-palette($foreground, text),
--adf-group-cloud-autosuggest-result-disabled-color: mat.get-color-from-palette($foreground, secondary-text),
--adf-group-cloud-input-caption-error-color: mat.get-color-from-palette($warn),
--adf-task-assignment-filter-option-default-color: mat.get-color-from-palette($foreground, text),
--adf-task-assignment-filter-option-selected-color: mat.get-color-from-palette($primary),
--adf-task-assignment-filter-label-default-color: mat.get-color-from-palette($foreground, secondary-text),
--adf-task-assignment-filter-label-focus-color: mat.get-color-from-palette($primary),
--adf-process-header-cloud-card-background: mat.get-color-from-palette($background, card),
--adf-group-cloud-input-label-default-color: mat.m2-get-color-from-palette($foreground, secondary-text),
--adf-group-cloud-input-label-focus-color: mat.m2-get-color-from-palette($primary),
--adf-group-cloud-autosuggest-result-active-color: mat.m2-get-color-from-palette($foreground, text),
--adf-group-cloud-autosuggest-result-disabled-color: mat.m2-get-color-from-palette($foreground, secondary-text),
--adf-group-cloud-input-caption-error-color: mat.m2-get-color-from-palette($warn),
--adf-task-assignment-filter-option-default-color: mat.m2-get-color-from-palette($foreground, text),
--adf-task-assignment-filter-option-selected-color: mat.m2-get-color-from-palette($primary),
--adf-task-assignment-filter-label-default-color: mat.m2-get-color-from-palette($foreground, secondary-text),
--adf-task-assignment-filter-label-focus-color: mat.m2-get-color-from-palette($primary),
--adf-process-header-cloud-card-background: mat.m2-get-color-from-palette($background, card),
--adf-header-icon-button-default-color: $adf-ref-header-icon-color,
--adf-header-icon-button-default-border-radius: $adf-ref-header-icon-border-radius,
--adf-header-icon-button-hover-color: $adf-ref-header-icon-color,
@@ -89,7 +89,7 @@
--adf-danger-button-background: $adf-danger-button-background,
--adf-secondary-button-background: $adf-secondary-button-background,
--adf-display-external-property-widget-preview-selection-color: mat.get-color-from-palette($foreground, secondary-text)
--adf-display-external-property-widget-preview-selection-color: mat.m2-get-color-from-palette($foreground, secondary-text)
);
// propagates SCSS variables into the CSS variables scope

View File

@@ -28,66 +28,66 @@
// map SCSS variables to expose as CSS variables
$defaults: (
// theme colors
--theme-primary-color: mat.get-color-from-palette($primary),
--theme-primary-color-default-contrast: mat.get-color-from-palette($primary, default-contrast),
--theme-header-text-color: mat.get-color-from-palette($primary, default-contrast),
--adf-theme-primary-50:mat.get-color-from-palette($primary, 50),
--adf-theme-primary-100:mat.get-color-from-palette($primary, 100),
--adf-theme-primary-300:mat.get-color-from-palette($primary, 300),
--adf-theme-primary-900:mat.get-color-from-palette($primary, 900),
--theme-primary-color: mat.m2-get-color-from-palette($primary),
--theme-primary-color-default-contrast: mat.m2-get-color-from-palette($primary, default-contrast),
--theme-header-text-color: mat.m2-get-color-from-palette($primary, default-contrast),
--adf-theme-primary-50:mat.m2-get-color-from-palette($primary, 50),
--adf-theme-primary-100:mat.m2-get-color-from-palette($primary, 100),
--adf-theme-primary-300:mat.m2-get-color-from-palette($primary, 300),
--adf-theme-primary-900:mat.m2-get-color-from-palette($primary, 900),
--theme-warn-color: mat.get-color-from-palette($warn),
--theme-warn-color-a700: mat.get-color-from-palette($warn, A700),
--theme-warn-color-default-contrast: mat.get-color-from-palette($warn, default-contrast),
--theme-warn-color: mat.m2-get-color-from-palette($warn),
--theme-warn-color-a700: mat.m2-get-color-from-palette($warn, A700),
--theme-warn-color-default-contrast: mat.m2-get-color-from-palette($warn, default-contrast),
--theme-accent-color: mat.get-color-from-palette($accent),
--theme-accent-color-a200: mat.get-color-from-palette($accent, A200),
--theme-accent-color-default-contrast: mat.get-color-from-palette($accent, default-contrast),
--theme-accent-500:mat.get-color-from-palette($accent, 500),
--theme-accent-color: mat.m2-get-color-from-palette($accent),
--theme-accent-color-a200: mat.m2-get-color-from-palette($accent, A200),
--theme-accent-color-default-contrast: mat.m2-get-color-from-palette($accent, default-contrast),
--theme-accent-500:mat.m2-get-color-from-palette($accent, 500),
--adf-theme-foreground-base-color: mat.get-color-from-palette($foreground, base),
--adf-theme-foreground-base-color-065: mat.get-color-from-palette($foreground, base, 0.65),
--adf-theme-foreground-base-color-045: mat.get-color-from-palette($foreground, base, 0.45),
--adf-theme-foreground-disabled-text-color: mat.get-color-from-palette($foreground, disabled-text),
--adf-theme-foreground-divider-color: mat.get-color-from-palette($foreground, divider),
--adf-theme-foreground-icon-color: mat.get-color-from-palette($foreground, icon),
--adf-theme-foreground-icon-color-054: mat.get-color-from-palette($foreground, icon, 0.54),
--adf-theme-foreground-secondary-text-color: mat.get-color-from-palette($foreground, secondary-text),
--adf-theme-foreground-text-color: mat.get-color-from-palette($foreground, text),
--adf-theme-foreground-text-color-087: mat.get-color-from-palette($foreground, text, 0.87),
--adf-theme-foreground-text-color-075: mat.get-color-from-palette($foreground, text, 0.75),
--adf-theme-foreground-text-color-064: mat.get-color-from-palette($foreground, text, 0.64),
--adf-theme-foreground-text-color-054: mat.get-color-from-palette($foreground, text, 0.54),
--adf-theme-foreground-text-color-040: mat.get-color-from-palette($foreground, text, 0.4),
--adf-theme-foreground-text-color-027: mat.get-color-from-palette($foreground, text, 0.27),
--adf-theme-foreground-text-color-025: mat.get-color-from-palette($foreground, text, 0.25),
--adf-theme-foreground-text-color-014: mat.get-color-from-palette($foreground, text, 0.14),
--adf-theme-foreground-text-color-007: mat.get-color-from-palette($foreground, text, 0.07),
--adf-theme-foreground-base-color: mat.m2-get-color-from-palette($foreground, base),
--adf-theme-foreground-base-color-065: mat.m2-get-color-from-palette($foreground, base, 0.65),
--adf-theme-foreground-base-color-045: mat.m2-get-color-from-palette($foreground, base, 0.45),
--adf-theme-foreground-disabled-text-color: mat.m2-get-color-from-palette($foreground, disabled-text),
--adf-theme-foreground-divider-color: mat.m2-get-color-from-palette($foreground, divider),
--adf-theme-foreground-icon-color: mat.m2-get-color-from-palette($foreground, icon),
--adf-theme-foreground-icon-color-054: mat.m2-get-color-from-palette($foreground, icon, 0.54),
--adf-theme-foreground-secondary-text-color: mat.m2-get-color-from-palette($foreground, secondary-text),
--adf-theme-foreground-text-color: mat.m2-get-color-from-palette($foreground, text),
--adf-theme-foreground-text-color-087: mat.m2-get-color-from-palette($foreground, text, 0.87),
--adf-theme-foreground-text-color-075: mat.m2-get-color-from-palette($foreground, text, 0.75),
--adf-theme-foreground-text-color-064: mat.m2-get-color-from-palette($foreground, text, 0.64),
--adf-theme-foreground-text-color-054: mat.m2-get-color-from-palette($foreground, text, 0.54),
--adf-theme-foreground-text-color-040: mat.m2-get-color-from-palette($foreground, text, 0.4),
--adf-theme-foreground-text-color-027: mat.m2-get-color-from-palette($foreground, text, 0.27),
--adf-theme-foreground-text-color-025: mat.m2-get-color-from-palette($foreground, text, 0.25),
--adf-theme-foreground-text-color-014: mat.m2-get-color-from-palette($foreground, text, 0.14),
--adf-theme-foreground-text-color-007: mat.m2-get-color-from-palette($foreground, text, 0.07),
--adf-theme-background-card-color: mat.get-color-from-palette($background, card),
--adf-theme-background-card-color-087: mat.get-color-from-palette($background, card, 0.87),
--theme-background-color: mat.get-color-from-palette($background, background),
--adf-theme-background-dialog-color: mat.get-color-from-palette($background, dialog),
--adf-theme-background-hover-color: mat.get-color-from-palette($background, hover),
--adf-theme-background-selected-button-color: mat.get-color-from-palette($background, selected-button),
--adf-theme-background-status-bar-color: mat.get-color-from-palette($background, status-bar),
--adf-theme-background-unselected-chip-color: mat.get-color-from-palette($background, unselected-chip),
--adf-theme-background-card-color: mat.m2-get-color-from-palette($background, card),
--adf-theme-background-card-color-087: mat.m2-get-color-from-palette($background, card, 0.87),
--theme-background-color: mat.m2-get-color-from-palette($background, background),
--adf-theme-background-dialog-color: mat.m2-get-color-from-palette($background, dialog),
--adf-theme-background-hover-color: mat.m2-get-color-from-palette($background, hover),
--adf-theme-background-selected-button-color: mat.m2-get-color-from-palette($background, selected-button),
--adf-theme-background-status-bar-color: mat.m2-get-color-from-palette($background, status-bar),
--adf-theme-background-unselected-chip-color: mat.m2-get-color-from-palette($background, unselected-chip),
// typography
--theme-font-family: mat.font-family($typography),
--theme-body-1-font-size: mat.font-size($typography, body-2),
--theme-body-2-font-size: mat.font-size($typography, subtitle-2),
--theme-body-1-line-height: mat.line-height($typography, body-2),
--theme-display-1-font-size: mat.font-size($typography, headline-4),
--theme-display-3-font-size: mat.font-size($typography, headline-2),
--theme-display-4-font-size: mat.font-size($typography, headline-1),
--theme-caption-font-size: mat.font-size($typography, caption),
--theme-title-font-size: mat.font-size($typography, headline-6),
--theme-subheading-1-font-size: mat.font-size($typography, body-1),
--theme-subheading-2-font-size: mat.font-size($typography, subtitle-1),
--theme-button-font-size: mat.font-size($typography, button),
--theme-headline-font-size: mat.font-size($typography, headline-5),
--theme-headline-line-height: mat.line-height($typography, headline-5),
--theme-font-family: mat.m2-font-family($typography),
--theme-body-1-font-size: mat.m2-font-size($typography, body-2),
--theme-body-2-font-size: mat.m2-font-size($typography, subtitle-2),
--theme-body-1-line-height: mat.m2-line-height($typography, body-2),
--theme-display-1-font-size: mat.m2-font-size($typography, headline-4),
--theme-display-3-font-size: mat.m2-font-size($typography, headline-2),
--theme-display-4-font-size: mat.m2-font-size($typography, headline-1),
--theme-caption-font-size: mat.m2-font-size($typography, caption),
--theme-title-font-size: mat.m2-font-size($typography, headline-6),
--theme-subheading-1-font-size: mat.m2-font-size($typography, body-1),
--theme-subheading-2-font-size: mat.m2-font-size($typography, subtitle-1),
--theme-button-font-size: mat.m2-font-size($typography, button),
--theme-headline-font-size: mat.m2-font-size($typography, headline-5),
--theme-headline-line-height: mat.m2-line-height($typography, headline-5),
--theme-adf-icon-1-font-size: map-get($custom-css-variables, 'theme-adf-icon-1-font-size'),
--theme-adf-picture-1-font-size: map-get($custom-css-variables, 'theme-adf-picture-1-font-size'),
@@ -95,9 +95,9 @@
--theme-adf-task-title-font-size: map-get($custom-css-variables, 'theme-adf-task-title-font-size'),
// specific colors
--adf-theme-mat-grey-color-a200: mat.get-color-from-palette(mat.$grey-palette, A200),
--adf-theme-mat-grey-color-a400: mat.get-color-from-palette(mat.$grey-palette, A400),
--adf-theme-mat-grey-color-50: mat.get-color-from-palette(mat.$grey-palette, 50),
--adf-theme-mat-grey-color-a200: mat.m2-get-color-from-palette(mat.$m2-grey-palette, A200),
--adf-theme-mat-grey-color-a400: mat.m2-get-color-from-palette(mat.$m2-grey-palette, A400),
--adf-theme-mat-grey-color-50: mat.m2-get-color-from-palette(mat.$m2-grey-palette, 50),
// spacing
--adf-theme-spacing: map-get($custom-css-variables, 'theme-adf-spacing')

View File

@@ -1,18 +1,18 @@
@use '@angular/material' as mat;
$alfresco-typography: mat.define-typography-config(
$alfresco-typography: mat.m2-define-typography-config(
$font-family: 'Muli, Roboto, "Helvetica Neue", sans-serif',
$headline-1: mat.define-typography-level(112px, 112px, 300),
$headline-2: mat.define-typography-level(56px, 56px, 400),
$headline-3: mat.define-typography-level(45px, 48px, 400),
$headline-4: mat.define-typography-level(34px, 40px, 400),
$headline-5: mat.define-typography-level(24px, 32px, 400),
$headline-6: mat.define-typography-level(20px, 32px, 500),
$subtitle-1: mat.define-typography-level(16px, 28px, 400),
$body-1: mat.define-typography-level(15px, 24px, 400),
$subtitle-2: mat.define-typography-level(14px, 24px, 500),
$body-2: mat.define-typography-level(14px, 20px, 400),
$caption: mat.define-typography-level(12px, 20px, 400),
$button: mat.define-typography-level(14px, 14px, 500),
$headline-1: mat.m2-define-typography-level(112px, 112px, 300),
$headline-2: mat.m2-define-typography-level(56px, 56px, 400),
$headline-3: mat.m2-define-typography-level(45px, 48px, 400),
$headline-4: mat.m2-define-typography-level(34px, 40px, 400),
$headline-5: mat.m2-define-typography-level(24px, 32px, 400),
$headline-6: mat.m2-define-typography-level(20px, 32px, 500),
$subtitle-1: mat.m2-define-typography-level(16px, 28px, 400),
$body-1: mat.m2-define-typography-level(15px, 24px, 400),
$subtitle-2: mat.m2-define-typography-level(14px, 24px, 500),
$body-2: mat.m2-define-typography-level(14px, 20px, 400),
$caption: mat.m2-define-typography-level(12px, 20px, 400),
$button: mat.m2-define-typography-level(14px, 14px, 500),
// Line-height must be unit-less fraction of the font-size.
);

View File

@@ -4,10 +4,10 @@
@include mat.all-component-typographies;
@include mat.core;
$primary: mat.define-palette($alfresco-ecm-blue);
$accent: mat.define-palette($alfresco-accent-orange);
$warn: mat.define-palette($alfresco-warn);
$theme: mat.define-light-theme(
$primary: mat.m2-define-palette($alfresco-ecm-blue);
$accent: mat.m2-define-palette($alfresco-accent-orange);
$warn: mat.m2-define-palette($alfresco-warn);
$theme: mat.m2-define-light-theme(
(
color: (
primary: $primary,

View File

@@ -4,10 +4,10 @@
@include mat.all-component-typographies;
@include mat.core;
$primary: mat.define-palette(mat.$pink-palette, 700, 500, 900);
$accent: mat.define-palette($alfresco-accent-purple);
$warn: mat.define-palette($alfresco-warn);
$theme: mat.define-light-theme(
$primary: mat.m2-define-palette(mat.$m2-pink-palette, 700, 500, 900);
$accent: mat.m2-define-palette($alfresco-accent-purple);
$warn: mat.m2-define-palette($alfresco-warn);
$theme: mat.m2-define-light-theme(
(
color: (
primary: $primary,

View File

@@ -4,10 +4,10 @@
@include mat.all-component-typographies;
@include mat.core;
$primary: mat.define-palette($alfresco-ecm-cyan);
$accent: mat.define-palette($alfresco-accent-orange);
$warn: mat.define-palette($alfresco-warn);
$theme: mat.define-light-theme(
$primary: mat.m2-define-palette($alfresco-ecm-cyan);
$accent: mat.m2-define-palette($alfresco-accent-orange);
$warn: mat.m2-define-palette($alfresco-warn);
$theme: mat.m2-define-light-theme(
(
color: (
primary: $primary,

View File

@@ -4,10 +4,10 @@
@include mat.all-component-typographies;
@include mat.core;
$primary: mat.define-palette($alfresco-ecm-cyan);
$accent: mat.define-palette($alfresco-accent-purple);
$warn: mat.define-palette($alfresco-warn);
$theme: mat.define-light-theme(
$primary: mat.m2-define-palette($alfresco-ecm-cyan);
$accent: mat.m2-define-palette($alfresco-accent-purple);
$warn: mat.m2-define-palette($alfresco-warn);
$theme: mat.m2-define-light-theme(
(
color: (
primary: $primary,

View File

@@ -4,10 +4,10 @@
@include mat.all-component-typographies;
@include mat.core;
$primary: mat.define-palette($alfresco-bpm-green);
$accent: mat.define-palette($alfresco-accent-orange);
$warn: mat.define-palette($alfresco-warn);
$theme: mat.define-light-theme(
$primary: mat.m2-define-palette($alfresco-bpm-green);
$accent: mat.m2-define-palette($alfresco-accent-orange);
$warn: mat.m2-define-palette($alfresco-warn);
$theme: mat.m2-define-light-theme(
(
color: (
primary: $primary,

View File

@@ -4,10 +4,10 @@
@include mat.all-component-typographies;
@include mat.core;
$primary: mat.define-palette($alfresco-bpm-green);
$accent: mat.define-palette($alfresco-accent-purple);
$warn: mat.define-palette($alfresco-warn);
$theme: mat.define-light-theme(
$primary: mat.m2-define-palette($alfresco-bpm-green);
$accent: mat.m2-define-palette($alfresco-accent-purple);
$warn: mat.m2-define-palette($alfresco-warn);
$theme: mat.m2-define-light-theme(
(
color: (
primary: $primary,

View File

@@ -5,10 +5,10 @@
@include mat.all-component-typographies;
@include mat.core;
$primary: mat.define-palette(mat.$indigo-palette);
$accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);
$warn: mat.define-palette($alfresco-warn);
$theme: mat.define-light-theme(
$primary: mat.m2-define-palette(mat.$m2-indigo-palette);
$accent: mat.m2-define-palette(mat.$m2-pink-palette, A200, A100, A400);
$warn: mat.m2-define-palette($alfresco-warn);
$theme: mat.m2-define-light-theme(
(
color: (
primary: $primary,

View File

@@ -5,10 +5,10 @@
@include mat.all-component-typographies;
@include mat.core;
$primary: mat.define-palette(mat.$pink-palette, 700, 500, 900);
$accent: mat.define-palette(mat.$blue-grey-palette, A200, A100, A400);
$warn: mat.define-palette($alfresco-warn);
$theme: mat.define-dark-theme(
$primary: mat.m2-define-palette(mat.$m2-pink-palette, 700, 500, 900);
$accent: mat.m2-define-palette(mat.$m2-blue-grey-palette, A200, A100, A400);
$warn: mat.m2-define-palette($alfresco-warn);
$theme: mat.m2-define-dark-theme(
(
color: (
primary: $primary,

View File

@@ -5,10 +5,10 @@
@include mat.all-component-typographies;
@include mat.core;
$primary: mat.define-palette(mat.$purple-palette, 700, 500, 800);
$accent: mat.define-palette(mat.$green-palette, A200, A100, A400);
$warn: mat.define-palette($alfresco-warn);
$theme: mat.define-dark-theme(
$primary: mat.m2-define-palette(mat.$m2-purple-palette, 700, 500, 800);
$accent: mat.m2-define-palette(mat.$m2-green-palette, A200, A100, A400);
$warn: mat.m2-define-palette($alfresco-warn);
$theme: mat.m2-define-dark-theme(
(
color: (
primary: $primary,

View File

@@ -29,22 +29,17 @@ import { TranslationMock } from '../mock/translation.service.mock';
import { DatePipe } from '@angular/common';
import { CookieService } from '../common/services/cookie.service';
import { CookieServiceMock } from '../mock/cookie.service.mock';
import { HttpClientModule } from '@angular/common/http';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { directionalityConfigFactory } from '../common/services/directionality-config-factory';
import { DirectionalityConfigService } from '../common/services/directionality-config.service';
import { AuthModule, RedirectAuthService } from '../auth';
import { EMPTY, of } from 'rxjs';
@NgModule({
imports: [
AuthModule.forRoot({ useHash: true }),
@NgModule({ exports: [NoopAnimationsModule, CoreModule, TranslateModule, RouterTestingModule], imports: [AuthModule.forRoot({ useHash: true }),
NoopAnimationsModule,
RouterTestingModule,
HttpClientModule,
TranslateModule.forRoot(),
CoreModule.forRoot()
],
providers: [
CoreModule.forRoot()], providers: [
DatePipe,
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
{ provide: AppConfigService, useClass: AppConfigServiceMock },
@@ -56,8 +51,7 @@ import { EMPTY, of } from 'rxjs';
deps: [DirectionalityConfigService],
multi: true
},
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY, init: () => {}, onTokenReceived: of() } }
],
exports: [NoopAnimationsModule, CoreModule, TranslateModule, RouterTestingModule]
})
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY, init: () => { }, onTokenReceived: of() } },
provideHttpClient(withInterceptorsFromDi())
] })
export class CoreTestingModule {}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { HttpClientModule } from '@angular/common/http';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { Injector } from '@angular/core';
import { getTestBed, TestBed } from '@angular/core/testing';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
@@ -35,21 +35,19 @@ describe('TranslationService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
HttpClientModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useClass: TranslateLoaderService
}
})
],
providers: [
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
{ provide: AppConfigService, useClass: AppConfigServiceMock },
provideTranslations('@alfresco/adf-core', 'assets/ng2-alfresco-core')
]
});
imports: [TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useClass: TranslateLoaderService
}
})],
providers: [
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
{ provide: AppConfigService, useClass: AppConfigServiceMock },
provideTranslations('@alfresco/adf-core', 'assets/ng2-alfresco-core'),
provideHttpClient(withInterceptorsFromDi())
]
});
jasmine.Ajax.install();

View File

@@ -16,9 +16,10 @@
*/
import { AppExtensionService } from '@alfresco/adf-extensions';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';
import { ViewUtilService } from './view-util.service';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
describe('ViewUtilService', () => {
let viewUtilService: ViewUtilService;
@@ -27,9 +28,9 @@ describe('ViewUtilService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
providers: [AppExtensionService]
});
imports: [],
providers: [AppExtensionService, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
});
viewUtilService = TestBed.inject(ViewUtilService);
appExtensionService = TestBed.inject(AppExtensionService);