Skip to content

Commit 2716600

Browse files
Upgrade to Angular 18
1 parent d695029 commit 2716600

22 files changed

Lines changed: 1726 additions & 997 deletions

frontend/angular.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"index": "src/index.html",
2525
"browser": "src/main.ts",
2626
"polyfills": [
27-
"zone.js"
27+
"zone.js",
28+
"@angular/localize/init"
2829
],
2930
"tsConfig": "tsconfig.app.json",
3031
"inlineStyleLanguage": "scss",
@@ -119,7 +120,8 @@
119120
"options": {
120121
"polyfills": [
121122
"zone.js",
122-
"zone.js/testing"
123+
"zone.js/testing",
124+
"@angular/localize/init"
123125
],
124126
"tsConfig": "tsconfig.spec.json",
125127
"inlineStyleLanguage": "scss",
@@ -150,4 +152,4 @@
150152
}
151153
}
152154
}
153-
}
155+
}

frontend/package.json

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,62 @@
11
{
2-
"name": "langpro-annotator",
3-
"scripts": {
4-
"start": "yarn serve",
5-
"build": "ng build --base-href=/static/ --localize",
6-
"watch": "ng build --watch",
7-
"test": "ng test --watch=true",
8-
"serve:ssr:langpro-annotator": "node dist/langpro-annotator/server/server.mjs",
9-
"prebuild": "node ./build/build-pre.js",
10-
"i18n": "ng extract-i18n --output-path locale",
11-
"preserve": "yarn prebuild",
12-
"serve": "ng serve",
13-
"serve:en": "ng serve --configuration=en",
14-
"serve:nl": "ng serve --configuration=nl",
15-
"stop": "lsof -t -i tcp:4200 | xargs kill -9 || echo \"not running\"",
16-
"pretest": "yarn prebuild",
17-
"test-once": "ng test --watch=false"
18-
},
19-
"private": true,
20-
"dependencies": {
21-
"@angular/animations": "^17.3.0",
22-
"@angular/common": "^17.3.0",
23-
"@angular/compiler": "^17.3.0",
24-
"@angular/core": "^17.3.0",
25-
"@angular/forms": "^17.3.0",
26-
"@angular/platform-browser": "^17.3.0",
27-
"@angular/platform-browser-dynamic": "^17.3.0",
28-
"@angular/platform-server": "^17.3.0",
29-
"@angular/router": "^17.3.0",
30-
"@angular/ssr": "^17.3.13",
31-
"@fortawesome/angular-fontawesome": "^0.14.1",
32-
"@fortawesome/fontawesome-svg-core": "^6.5.2",
33-
"@fortawesome/free-solid-svg-icons": "^6.5.2",
34-
"@ng-bootstrap/ng-bootstrap": "^16.0.0",
35-
"@ngrx/effects": "^17.2.0",
36-
"@ngrx/store": "^17.2.0",
37-
"@popperjs/core": "^2.11.8",
38-
"bootstrap": "^5.3.3",
39-
"colors": "^1.4.0",
40-
"express": "^4.18.2",
41-
"rxjs": "~7.8.0",
42-
"tslib": "^2.3.0",
43-
"zone.js": "~0.14.3"
44-
},
45-
"devDependencies": {
46-
"@angular-devkit/build-angular": "^17.3.13",
47-
"@angular/cli": "^17.3.13",
48-
"@angular/compiler-cli": "^17.3.0",
49-
"@angular/localize": "17.3.12",
50-
"@types/express": "^4.17.17",
51-
"@types/jasmine": "~5.1.0",
52-
"@types/node": "^18.18.0",
53-
"jasmine-core": "~5.1.0",
54-
"karma": "~6.4.0",
55-
"karma-chrome-launcher": "~3.2.0",
56-
"karma-coverage": "~2.2.0",
57-
"karma-jasmine": "~5.1.0",
58-
"karma-jasmine-html-reporter": "~2.1.0",
59-
"ng-extract-i18n-merge": "^2.12.0",
60-
"typescript": "~5.4.2"
61-
}
2+
"name": "langpro-annotator",
3+
"scripts": {
4+
"start": "yarn serve",
5+
"build": "ng build --base-href=/static/ --localize",
6+
"watch": "ng build --watch",
7+
"test": "ng test --watch=true",
8+
"serve:ssr:langpro-annotator": "node dist/langpro-annotator/server/server.mjs",
9+
"prebuild": "node ./build/build-pre.js",
10+
"i18n": "ng extract-i18n --output-path locale",
11+
"preserve": "yarn prebuild",
12+
"serve": "ng serve",
13+
"serve:en": "ng serve --configuration=en",
14+
"serve:nl": "ng serve --configuration=nl",
15+
"stop": "lsof -t -i tcp:4200 | xargs kill -9 || echo \"not running\"",
16+
"pretest": "yarn prebuild",
17+
"test-once": "ng test --watch=false"
18+
},
19+
"private": true,
20+
"dependencies": {
21+
"@angular/animations": "^18.2.13",
22+
"@angular/common": "^18.2.13",
23+
"@angular/compiler": "^18.2.13",
24+
"@angular/core": "^18.2.13",
25+
"@angular/forms": "^18.2.13",
26+
"@angular/platform-browser": "^18.2.13",
27+
"@angular/platform-browser-dynamic": "^18.2.13",
28+
"@angular/platform-server": "^18.2.13",
29+
"@angular/router": "^18.2.13",
30+
"@angular/ssr": "^18.2.19",
31+
"@fortawesome/angular-fontawesome": "^0.14.1",
32+
"@fortawesome/fontawesome-svg-core": "^6.5.2",
33+
"@fortawesome/free-solid-svg-icons": "^6.5.2",
34+
"@ng-bootstrap/ng-bootstrap": "^16.0.0",
35+
"@ngrx/effects": "^17.2.0",
36+
"@ngrx/store": "^17.2.0",
37+
"@popperjs/core": "^2.11.8",
38+
"bootstrap": "^5.3.3",
39+
"colors": "^1.4.0",
40+
"express": "^4.18.2",
41+
"rxjs": "~7.8.0",
42+
"tslib": "^2.3.0",
43+
"zone.js": "~0.14.3"
44+
},
45+
"devDependencies": {
46+
"@angular-devkit/build-angular": "^18.2.19",
47+
"@angular/cli": "^18.2.19",
48+
"@angular/compiler-cli": "^18.2.13",
49+
"@angular/localize": "18.2.13",
50+
"@types/express": "^4.17.17",
51+
"@types/jasmine": "~5.1.0",
52+
"@types/node": "^18.18.0",
53+
"jasmine-core": "~5.1.0",
54+
"karma": "~6.4.0",
55+
"karma-chrome-launcher": "~3.2.0",
56+
"karma-coverage": "~2.2.0",
57+
"karma-jasmine": "~5.1.0",
58+
"karma-jasmine-html-reporter": "~2.1.0",
59+
"ng-extract-i18n-merge": "^2.12.0",
60+
"typescript": "~5.4.2"
61+
}
6262
}

frontend/src/app/annotate/annotate.component.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { ComponentFixture, TestBed } from "@angular/core/testing";
22

33
import { AnnotateComponent } from "./annotate.component";
4+
import { ActivatedRoute } from "@angular/router";
5+
import { of } from "rxjs";
6+
import { provideHttpClient } from "@angular/common/http";
7+
import { provideHttpClientTesting } from "@angular/common/http/testing";
48

59
describe("AnnotateComponent", () => {
610
let component: AnnotateComponent;
@@ -9,6 +13,16 @@ describe("AnnotateComponent", () => {
913
beforeEach(async () => {
1014
await TestBed.configureTestingModule({
1115
imports: [AnnotateComponent],
16+
providers: [
17+
provideHttpClient(),
18+
provideHttpClientTesting(),
19+
{
20+
provide: ActivatedRoute,
21+
useValue: {
22+
params: of({ problemId: "1" }),
23+
}
24+
}
25+
]
1226
}).compileComponents();
1327

1428
fixture = TestBed.createComponent(AnnotateComponent);

frontend/src/app/annotate/annotation-input/annotation-input.component.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { ComponentFixture, TestBed } from "@angular/core/testing";
22

33
import { AnnotationInputComponent } from "./annotation-input.component";
4+
import { provideHttpClientTesting } from "@angular/common/http/testing";
5+
import { provideHttpClient } from "@angular/common/http";
46

57
describe("AnnotationInputComponent", () => {
68
let component: AnnotationInputComponent;
@@ -9,6 +11,7 @@ describe("AnnotationInputComponent", () => {
911
beforeEach(async () => {
1012
await TestBed.configureTestingModule({
1113
imports: [AnnotationInputComponent],
14+
providers: [provideHttpClient(), provideHttpClientTesting()],
1215
}).compileComponents();
1316

1417
fixture = TestBed.createComponent(AnnotationInputComponent);

frontend/src/app/annotate/annotation-input/premises-form/premises-form.component.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { ComponentFixture, TestBed } from "@angular/core/testing";
22

33
import { PremisesFormComponent } from "./premises-form.component";
4+
import { provideHttpClient } from "@angular/common/http";
5+
import { provideHttpClientTesting } from "@angular/common/http/testing";
46

57
describe("PremisesFormComponent", () => {
68
let component: PremisesFormComponent;
@@ -9,6 +11,10 @@ describe("PremisesFormComponent", () => {
911
beforeEach(async () => {
1012
await TestBed.configureTestingModule({
1113
imports: [PremisesFormComponent],
14+
providers: [
15+
provideHttpClient(),
16+
provideHttpClientTesting(),
17+
]
1218
}).compileComponents();
1319

1420
fixture = TestBed.createComponent(PremisesFormComponent);

frontend/src/app/annotate/navigator/navigator.component.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { ComponentFixture, TestBed } from "@angular/core/testing";
22

33
import { NavigatorComponent } from "./navigator.component";
4+
import { ActivatedRoute } from "@angular/router";
5+
import { provideHttpClient } from "@angular/common/http";
6+
import { provideHttpClientTesting } from "@angular/common/http/testing";
7+
import { of } from "rxjs";
48

59
describe("NavigatorComponent", () => {
610
let component: NavigatorComponent;
@@ -9,6 +13,16 @@ describe("NavigatorComponent", () => {
913
beforeEach(async () => {
1014
await TestBed.configureTestingModule({
1115
imports: [NavigatorComponent],
16+
providers: [
17+
provideHttpClient(),
18+
provideHttpClientTesting(),
19+
{
20+
provide: ActivatedRoute,
21+
useValue: {
22+
params: of({ problemId: "1" }),
23+
},
24+
},
25+
],
1226
}).compileComponents();
1327

1428
fixture = TestBed.createComponent(NavigatorComponent);
Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
1-
import { TestBed, waitForAsync } from '@angular/core/testing';
2-
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
3-
import { RouterTestingModule } from '@angular/router/testing';
4-
import { HttpClientTestingModule } from '@angular/common/http/testing';
1+
import { TestBed, waitForAsync } from "@angular/core/testing";
2+
import { NoopAnimationsModule } from "@angular/platform-browser/animations";
3+
import { provideHttpClientTesting } from "@angular/common/http/testing";
54

6-
import { AppComponent } from './app.component';
5+
import { AppComponent } from "./app.component";
6+
import {
7+
provideHttpClient,
8+
withInterceptorsFromDi,
9+
} from "@angular/common/http";
10+
import { ActivatedRoute } from "@angular/router";
11+
import { of } from "rxjs";
712

8-
describe('AppComponent', () => {
13+
describe("AppComponent", () => {
914
beforeEach(waitForAsync(() => {
1015
TestBed.configureTestingModule({
11-
imports: [
12-
AppComponent, NoopAnimationsModule, RouterTestingModule, HttpClientTestingModule]
16+
imports: [AppComponent, NoopAnimationsModule],
17+
providers: [
18+
provideHttpClient(withInterceptorsFromDi()),
19+
provideHttpClientTesting(),
20+
{
21+
provide: ActivatedRoute,
22+
useValue: {
23+
params: of({ problemId: "1" }),
24+
},
25+
},
26+
],
1327
}).compileComponents();
1428
}));
1529

16-
17-
it('should create the app', () => {
30+
it("should create the app", () => {
1831
const fixture = TestBed.createComponent(AppComponent);
1932
const app = fixture.debugElement.componentInstance;
2033
expect(app).toBeTruthy();
@@ -26,10 +39,12 @@ describe('AppComponent', () => {
2639
expect(app.title).toEqual(`LangPro Annotator`);
2740
});
2841

29-
it('should render title', () => {
42+
it("should render title", () => {
3043
const fixture = TestBed.createComponent(AppComponent);
3144
fixture.detectChanges();
3245
const compiled = fixture.debugElement.nativeElement;
33-
expect(compiled.querySelector('.navbar-brand').textContent).toContain('LangPro Annotator');
46+
expect(compiled.querySelector(".navbar-brand").textContent).toContain(
47+
"LangPro Annotator"
48+
);
3449
});
3550
});

frontend/src/app/app.config.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import { ApplicationConfig, provideZoneChangeDetection } from "@angular/core";
22
import { APP_BASE_HREF } from "@angular/common";
3-
import {
4-
provideHttpClient,
5-
withFetch,
6-
withInterceptors,
7-
withXsrfConfiguration,
8-
} from "@angular/common/http";
3+
import { provideHttpClient, withFetch, withInterceptors, withXsrfConfiguration } from "@angular/common/http";
94
import { provideClientHydration } from "@angular/platform-browser";
105
import { provideAnimations } from "@angular/platform-browser/animations";
116
import { provideRouter } from "@angular/router";

frontend/src/app/footer/footer.component.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
2-
import { HttpClientTestingModule } from '@angular/common/http/testing';
2+
import { provideHttpClientTesting } from '@angular/common/http/testing';
33
import { FooterComponent } from './footer.component';
4+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
45

56
describe('FooterComponent', () => {
67
let component: FooterComponent;
78
let fixture: ComponentFixture<FooterComponent>;
89

910
beforeEach(waitForAsync(() => {
1011
TestBed.configureTestingModule({
11-
imports: [FooterComponent, HttpClientTestingModule]
12-
})
12+
imports: [FooterComponent],
13+
providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
14+
})
1315
.compileComponents();
1416
}));
1517

frontend/src/app/home/home.component.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
2-
import { HttpClientTestingModule } from '@angular/common/http/testing';
2+
import { provideHttpClientTesting } from '@angular/common/http/testing';
33
import { HomeComponent } from './home.component';
4+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
45

56
describe('HomeComponent', () => {
67
let component: HomeComponent;
78
let fixture: ComponentFixture<HomeComponent>;
89

910
beforeEach(waitForAsync(() => {
1011
TestBed.configureTestingModule({
11-
imports: [HomeComponent, HttpClientTestingModule]
12-
})
12+
imports: [HomeComponent],
13+
providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
14+
})
1315
.compileComponents();
1416
}));
1517

0 commit comments

Comments
 (0)